Changing root password in Linux

In this article we will show how to change the default root password. As you know we provide VPS and dedicated servers with auto-generated passwords and we recommend to change it right after delivery to maximise the instance secure.

As all of you know the root account on a Linux server is the highest authority account on the system (superuser). This access has control over everything, can add, modify or even destroy anything, has right to start or stop any script.

How to change your default root password in CentOS? (Linux distribution). Actually most of Linux distribution are very close and it will work also in Ubuntu, Debian and Fedora. And it will not take much time to complete this task.

Step 1: Connect
Open SSH client (Terminal app) and connect to a server using the default root password.

$ ssh [email protected]

Step 2: Change password

Now request your root password change.

$ sudo -i passwd

You will be asked to enter the password of your user account in order to authenticate the change. Of course, this assumes that your account is in the sudo users list, which essentially means that your account is an administrator account.

Changing password for user root.
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully.

Once this is done, you will have successfully changed the password of the root user. If you have changed the password for ‘root’ being logged from another account, all you have to do is log-out of that another account and just log-in using the ‘root’ username.

Looking for a custom solution?

Our technicians can provide you with the best custom made solutions on the market, no matter whether you're a small business or large enterprise.

Get in touch