Skip to content

Changing your root password on a CentOS server

You can change your root password on your CentOS server via SSH, with some simple commands by completing the following steps.

See also: Changing your root password on Plesk and cPanel.

Step 1

First of all, log in to the server via SSH.

Step 2

When logged in, if you are using the root user you just need to type:

sudo passwd root
[root@centos_server ~]# sudo passwd root
Changing password for user root.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@centos_server ~]#

Step 3

If you already have root permissions, you will not need to type ‘sudo’. You can also change the ‘root’ to be a different user if you’ve set one up. If you type ‘passwd’ alone, it will change the password for your current user. Here’s an example of a root user changing their own password with a shorter command:

[root@centos_server ~]# passwd
Changing password for user root.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@centos_server ~]#


Was this article helpful?

Related guides