Changing a user password in Linux

A normal Linux user can only change the password for his/her own account, but the super-user (root) may change the password for any user in the linux operating system.

For changing the password, the admin/super user is first prompted for his/her old password, if it exists. Then this password is encrypted and compared against the stored password.


The super-user has the ability to bypass the old password requirement so that forgotten passwords can be changed by a privileged user. 


passwd is the command to change your own password in Linux Terminal:


$ passwd

Changing password for steve
(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully


If you want to change the password for some other user, you can do that as well with the same command prefixed with “sudo”.


 # sudo passwd steve