How to Change Password in Linux

This is one of the easiest question to answer in linux. How to change password in Linux is a question that can be answered in just a single word. However, let us try to get into the details of using the command to change the password in Linux, along with the different arguments that the password offers.
Looking for the answer to one of the basic questions in Linux? How to change password? Well, a single command will help you change your password in Linux. The command to change password in Linux is passwd. The rules for setting a password in Linux is same as that of the other operating systems. By rules I mean the basic character set that you can use. With this information in hand, let us go into the details of changing the password procedure in Linux.

Linux: How to Change Password?

Whether you are looking for an answer to the question, how to set password in Linux or how to change user password in Linux, the answer is still the same. If you are the root user, then you have got the authority to change the password of all other users too. However, a common user can just change his own password. The syntax to change the password of a user in Linux is as follows.
passwd username

On typing this command, you will be prompted to enter the old password. Once you enter the old password and hit the enter key, you will be prompted to enter and re-enter the password. Once you are done with the procedure, you will be prompted that the password has been changed successfully. However, one thing that you need to keep in mind is that, when you type in your password in Linux, it does not display any asterisk sign or dots, as in the case of other operating systems. Now, let us take a look at the passwd command in a little more detail.

passwd Command

What are the other features that the passwd command allows you to change?
  • The passwd command also allows you to change the full name and username of a particular user. If you type passwd -s you will get the full user information of a particular user whose username is followed by the command. Besides the name, password and the date on which the userid was created, you also get to minimum and maximum number of days for which the password will remain valid.
  • passwd -g is used for changing the password of a group.
  • If you set the warn field using the command passwd -w, you can set the number of days before which the user will be warned to change the password.
  • The passwd -d command allows you to change the password for a particular user.
  • passwd -n allows you to assign the number of days between changing your password.
  • passwd -h commands allows you to change the home directory for a particular user.
  • passwd -l forces the user to change the password at the next login, by expiring the old password for that particular name.
This was a little insight on answering the question, how to change password in Linux and how to use the passwd command. You can try out other options like passwd -a, shows the password entry for all users in the system.
By
Published: 12/16/2009
Like This Article?
Follow:
Post Comment
Your Comments:
Your Name: