Phone :  +370 (5) 204-1903
Email :  sales@1gbits.com
  1. Dedicated server
  2. Blog
  3. How to switch to root account in Ubuntu?

How to switch to root account in Ubuntu?

The root user (or superuser) is a separate user account for both Linux and Unix-like platforms. It has complete and unrestricted access to all commands and resources on the machine. If you're switching from another Linux distribution to Ubuntu, you may be wondering what the default root password is and how to change it. The root user account is not enabled by default in Ubuntu for safety reasons. In this guide, we will discuss how to move to the root user account and establish the root password on Ubuntu platforms.

Ubnutu Tutorials Jun 09, 21 by Nisal N 3 min Read
How to switch to root account in Ubuntu?

List of content you will read in this article:

Switching to Root Temporarily

By assigning sudo rights to everyday users, Ubuntu users are encouraged to conduct server administrative tasks. Registered users can run programs as another user, normally the root user, using the Sudo command.

The sudo community is now a part of the initial user generated by the Ubuntu installer. It's likely that the person you're now logging in as has administrative rights. To briefly escalate root user rights, run the following command with the sudo prefix:

Sudo name

The very first moment you use sudo in a process, you'll be prompted for the user password.

To briefly switch to the root account in the current login session, use sudo su or sudo -i command and insert the user password:

sudo su 

or 

sudo -i

To ensure that the user has been updated as root, use the whoami command:

whoami

Output

root

Modifying Root Password

Since the root user has been disabled, this does not imply that the root account has been deleted. Since the root account has no password, logging in as root is not feasible.

All users have to do is open the root account to create a password for the system administrator. The passwd command in Ubuntu allows you to set or change a user account's password. When generating the password, make sure to use a strong and exclusive password. 

The most critical part of your account's protection is using a secure password. A good password usually consists of at least sixteen characters, an uppercase letter, a lowercase letter, an integer, and a special character. To change the root user's password in Ubuntu, type the command given below as a Sudo user:

sudo passwd root

You will be asked by the following command to enter and confirm the new root password. You will be prompted to retype it again. When you enter the password, it does not appear on the page. When you have successfully entered the new password, you will see the following output:

passwd: password updated successfully

The password for the root account has been updated. Users can now sign in to the Ubuntu system as root using the latest password.

Conclusion

The root account in Ubuntu has no password by default. The Sudo command is recommended for executing commands with root privileges. Before you could even log in as root, you will be needed to set the root password. We hope that the given information will help you to understand why the root user is not enabled by default.

People also read: 

author img

Nisal N

Computers has always fascinated me since I was a kid and here we are. I love travelling for 2 reasons: the first one to see a new part of the world and second (the most important one) to experience the rich culture hidden among the country and people. I'm pretty good at cooking but very poor when it comes to baking.

Leave A Comment