How to change a users password in Linux

Home > Search > How-to

Encrypted password

The passwd command followed by the username can be used to change the password. The new password will be encrypted.

[root@server1 ~]# passwd user1
New UNIX password: ********
Retype UNIX password: ********


The second field of the /etc/shadow file will contain the new, encrypted password.

[root@server1 ~]# cat /etc/shadow | grep user1


Refer to the passwd command.


Clear text password

The usermod command with the -p or --password option can be used to create a cleartext password.

[root@server1 ~]# usermod -p MyPassword user1


The second field in the /etc/passwd file will have an "x", because passwords are not stored in the /etc/passwd file.

[root@server1 ~]# cat /etc/passwd | grep user1


The second file in /etc/shadow will show either the encrypted or cleartext password.

[root@server1 ~]# cat /etc/shadow


Refer to the usermod command.

Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter in the box below so that we can be sure you are a human.