Objective

The objective is to set a root 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 to the system using 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

Ubuntu 18.04 Bionic Beaver installation comes with a blank root password as default. This is a security precaution as user is expected to never login as the root user. For any privileged administration tasks the user is required to use the sudo command.

Login as Root

Setting a root password comes with risks, hence if possible you should try to avoid it. If you only need to gain a temporary command line root access this can be achieved with the sudo -i command. Consider the following example:

login as root on Ubuntu 18.04 Bionic Beaver Linux

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


Set root password

The following sudo command will allow you to set the root password:
$ sudo passwd
Follow the prompt to enter and retype the new root password. Once the root password is set use the su command to gain root shell access. The whole procedure is illustrated below.

set 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.