Default root password on Ubuntu 20.04 Focal Fossa Linux

The objective of this guide is to access the root shell and optionally change the default root blank password on Ubuntu 20.04 Focal Fossa Linux.

In this tutorial you will learn:

  • How to execute Linux commands with administrative root privileges
  • How to change to root shell
  • How to set root password

Access root shell on Ubuntu 20.04 Focal Fossa Linux

Access root shell on Ubuntu 20.04 Focal Fossa Linux

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Installed or upgraded Ubuntu 20.04 Focal Fossa
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Access root shell on Ubuntu 20.04 Focal Fossa Linux step by step instructions

By default Ubuntu system ships with a blank root password. This means there isn’t a way to access root’s shell via the su command. This is not a fault but security measure. Users, are not expected to login as root and all commands which are required to be run under administrative privileges should be executed by the sudo prefix of the command itself. Example:



$ sudo mycommand
Password:

The following steps will explain how to set a root password on Ubuntu 20.04 Linux and thus gain a permanent access to root’s shell using the su command and the root password. Having a root password my be needed to access your Ubuntu system remotely via SSH.

  1. First step is to use sudo to set a root’s password:
    $ sudo passwd
    

    Another alternative is to become root first and then set the root password. Example:

    $ sudo -i
    Password:
    # passwd
    
  2. Access the root shell or login via SSH using the new root's password:
    $ su
    Password:
    
  3. Once you are in the root's shell confirm that you are logged in as root:
    # whoami
    root