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.

Difficulty

EASY

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

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

SUBSCRIBE TO NEWSLETTER
Subscribe to Linux Career NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.


Once the root password is set, you can login as root by using the su command:
$ su
Change default root password on Ubuntu
Access root shell and change the default root password on Ubuntu 18.04 Bionic Beaver Linux
ARE YOU LOOKING FOR A LINUX JOB?
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed on LinuxCareers.com.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.