[email protected]Support 24/7 · Billing 09:00 – 00:00LinkedInXFacebook
NexonHost
Netherlands Dedicated ServersAmsterdam · Equinix AM6Germany Dedicated ServersFrankfurt · Equinix FR4Romania Dedicated ServersBucharest · VoxilityAustria Dedicated ServersVienna · Interxion VIEBulgaria Dedicated ServersSofia · TelepointFrance Dedicated ServersParis · Interxion PAR — Marseille · Digital Realty MRS3Ireland Dedicated ServersDublin · Equinix DB2Italy Dedicated ServersMilan · Irideos AvalonPoland Dedicated ServersWarsawSpain Dedicated ServersMadrid · Equinix MD2United States Dedicated ServersAshburn · Equinix DC
All articles
Getting startedMarch 13, 2023

How to Change Root Password in Ubuntu Linux

How To Change Root Password In Ubuntu Linux

This tutorial explains how to temporally change to the root user account and how to set the root password on Ubuntu systems.

The root user (or superuser) is a special user account that is present on all Linux and Unix-like systems. It has full access to every command and any resource on the system without any restrictions.

If you are coming to Ubuntu from another Linux distribution, you may wonder what the default root password is or how to change the root password. By default, in Ubuntu, the root user account is disabled for security reasons.

 

Temporary Switching to root

Ubuntu users are encouraged to perform system administrative tasks by granting sudo privileges to regular users. Sudo allows authorized users to run programs as another user, usually the root user.

The initial user created by the Ubuntu installer is already a member of the sudo group. The chances are that the user you are logged in as is already granted with administrative privileges.

To temporarily elevate root user privileges, run the command prefixed with sudo :

sudo command-name

The first time you use sudo in a session, you will be prompted to enter the user password.

To temporally switch to the root account in the current login session, you can use either the sudo su or sudo -i command and enter the user password:

sudo su -

Run the whoami command to verify that the user is changed:

whoami
root

 

Changing Root Password

The root user is disabled, but that doesn’t mean that the root account has been removed. Logging in as root is not possible because no password has been set for the root account.

If for some reason, you need to enable the root account , all you need to do is to set a password for the root user. In Ubuntu, you can set or change the password of a user account with the passwd command.

To change the password of the root user in Ubuntu, run the following command as a sudo user :

sudo passwd root

You will be prompted to enter and confirm the new root password.

When setting the password, make sure you’re using a unique and robust password. Having a strong password is the most important aspect of the security of your account. Often a strong password has at least 16 characters, at least one uppercase letter, one lowercase letter, one number, and one special character.

The password is not shown on the screen when you type it.

Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

That’s it! The root password has been changed.

You can now log in to your Ubuntu system as root using the new password.

 

Conclusion

By default, in Ubuntu, the root account has no password set. The recommended approach is to use the sudo command to run commands with root-level privileges.

To be able to log in as root directly, you’ll need to set the root password.

Keep reading
How to Install PowerDNS and Poweradmin on CentOS 7
February 21, 2023

How to Install PowerDNS and Poweradmin on CentOS 7

How to Install PowerDNS and Poweradmin on CentOS 7 Step 1 – Install EPEL and Remi Repositories First of all, we need to install dependencies for the PowerDNS installation. We’re going to install the EPEL repository and the REMI for PHP 7.2 installation. Install EPEL and PHP Remi repository using…

Read article
How to use the MTR command on Linux
February 21, 2023

How to use the MTR command on Linux

How to use the MTR command on Linux MTR (Matt’s traceroute) is a program with a command-line interface that serves for network diagnostic and troubleshooting. The advantage of this software is that it combines the functionality of the Ping command and the Traceroute. Just like a typical traceroute…

Read article
How to Install a Let’s Encrypt Certificate on your Ubuntu 18.04 Dedicated Server or VPS
February 21, 2023

How to Install a Let’s Encrypt Certificate on your Ubuntu 18.04 Dedicated Server or VPS

How to Install a Let’s Encrypt Certificate on your Ubuntu 18.04 Dedicated Server or VPS Installing a Let’s Encrypt TLS/SSL (Transport Layer Security or Secure Sockets Layer) certificate is one of the most important steps in securing your Ubuntu 18.04 server. This is a plus to your website if you…

Read article
Get in Touch

Together, Let’s Build a Faster, Safer Internet.

Build scalable infrastructure with NexonHost — high-performance dedicated servers, VPS hosting, cloud hosting, and DDoS protection across Europe.

Get Started →Contact Us
[email protected]Support 24/7 · Billing 09:00 – 00:00