The objective of this tutorial is to set a root password on Ubuntu 20.04 Focal Fossa Linux.
In this tutorial you will learn:
- How to set root password
Software Requirements and Conventions Used
| Category | Requirements, Conventions or Software Version Used |
|---|---|
| System | Installed Ubuntu 20.04 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 |
How to set a root password on step by step instructions
Ubuntu 20.04 installation comes with a blank root password as default. This is a security precaution since the user is never expected to login as the root user. For any privileged administration tasks the user is recommended to use the
sudo command.
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.
- To set a root password open up a terminal window and execute the following
sudocommand. First, you need to enter your user password ( given that you are part of the sudo administration group ) after which enter and retype a new root password :$ sudo passwd [sudo] password for linuxconfig: New password: Retype new password: passwd: password updated successfully
- All done, you should now be ready to login with a new root password. Try it now:
$ su password:
- Use the
whoamicommand to confirm that you are logged in as a root user:# whoami root
