How to Enable Root User in Ubuntu 20.04
Ubuntu 20.04 is a popular Linux distribution that doesn’t have a root user account enabled by default. However, there may be instances where you need to access the root user for administrative tasks. This article will guide you through the process of enabling the root user in Ubuntu 20.04.
Step 1: Log in as a sudo user
Before enabling the root user, you need to ensure that you are logged in as a sudo user. A sudo user has the privilege to perform administrative tasks. Make sure you know the password for this sudo user as you will need it during the process.
Step 2: Set a password for the root user
To set a password for the root user, open a terminal window by pressing Ctrl+Alt+T
. In the terminal, type the following command:
sudo passwd root
You will be prompted to enter the password for the sudo user. Once you’ve entered the password, you can now set a new password for the root user. Follow the on-screen instructions to complete the process.
Step 3: Enable the root user
After setting the password for the root user, you can enable the root user account by running the following command:
sudo usermod -U root
This command will unlock the root user account and allow you to log in as root for administrative tasks. Remember to use the root user account with caution, as it has unrestricted access to system files and settings.
Step 4: Log in as the root user
Once you have enabled the root user account, you can log out of your current session and log back in as the root user. To switch to the root user, use the following command:
su root
You will be prompted to enter the root user’s password that you set in step 2. After entering the password, you will now be logged in as the root user and can perform administrative tasks as needed.
Step 5: Disable the root user (Optional)
For security purposes, it is recommended to disable the root user account when you no longer need to perform administrative tasks. To disable the root user account, run the following command:
sudo usermod -L root
This command will lock the root user account and prevent anyone from logging in as root. It’s always good practice to only enable the root user when necessary and disable it once you’ve completed your tasks.
By following these steps, you can enable the root user in Ubuntu 20.04 and perform administrative tasks with full access to system settings. Remember to use the root user account responsibly and disable it when not in use to ensure the security of your system.