Objective
The objective is to access root shell and optionally change the default root blank password on Ubuntu 18.04 Bionic Beaver Linux.
Operating System and Software Versions
- Operating System: – Ubuntu 18.04 Bionic Beaver Linux
Requirements
Privileged access to your Ubuntu System as root or via sudo
command is required.
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
Other Versions of this Tutorial
Instructions
There is no default root password on Ubuntu 18.04 Linux. However, if you need to execute a command with root privileges you can prefix your command with sudo
.
The below example will execute the whoami
command as a root user. Replace the below whoami
command with the command you wish to execute as root:
$ sudo whoami
If you do not wish to use the sudo
command every time you need to execute a command with root privileges you can gain the root shell by using the sudo
command and its -i
option:
$ sudo -i #
Please note that your command prompt will change from $
to #
which indicates that you are currently logged in as root.
If you wish to change the default blank root password and set root password enter:
$ sudo passwd
Once the root password is set, you can login as root by using the su
command:
$ su