How To Set or Change User Password In Linux?


Linux passwords are used to authenticate users. Linux passwords was holded in /etc/passwd file with other user related information like default shell, home directory path etc. Now in modern linux distributions holds passwords in /etc/shadow file which have restricted access. This file holds user passwords as hash values with salt. Hashing and salting makes passwords more secure.

Change Current User Password

To change a user password we need password change privilege. For currently logged user we can change passwords just like below.

  • passwd command will start change process for current user which is root.
  • New password: is asking new password and will not be printed to the screen for security reasons.
  • BAD PASSWORD is prompted because I have entered easy to crack password. For your productions systems please chose strong passwords.
  • Retype new password: is asking to enter same password for second time to avoid mistakes.
  • passwd: shows that password update process is completed successfully.

Change Other User Password.

To change other user password we need to be root user. We will provide the username to the passwd command in order to change user password. In this example we will change the password of user test

  • This is very similar to previous password change operation.
LEARN MORE  How To List All Repository Packages With Yum

Change Group Password

Linux operating system provides group for flexible privilege management. All users may have one or more groups. These groups also have passwords too. We can also change these password. We will use -g option in order to change group password. In this example we will change the group accountig password.

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)