Set root user password in Ubuntu 20.04 LTS focal fossa

Ubuntu is one of the popular Linux distro available to use free of cost under open-source licenses. The recent version of the Ubuntu while writing this article was Ubuntu 20.04 LTS focal fossa. Therefore, we are using the same to let you know the steps to set the root user password on Ubuntu 20.04 Desktop or Server. However, the steps are not only limited to this version and can be used on the previous ones. Such as Ubuntu 19.10/19.04, 18.10. 18.04, 16.04…

When installing a fresh Linux Distro of Ubuntu, by default there will not be any root password. However, while its installation, its wizard will give you an option to create a non-admin user in the sudo group. Thus, we need it to complete the steps given below.

  • Open command Terminal.
  • The shortcut for it is CTRL+ALT+T. For GUI based systems.
  • To set the root password on Ubuntu 20.04 or in previous versions, use the following command:
sudo passwd root
  • The setup will ask you to enter a new password two times.
  • After that, the setup will give the confirmation, that your commands are completed successfully.
  • Now, try to login root with the created password.
su root
  • Enter the password:

So, finally, your root is protected and can be used by you using a password.

set Ubuntu 20.04 root user password

However, if you don’t want to set the password for security reasons, then you can switch to root without knowing its password. The command for that is

sudo -i



Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.