Linux set or change user password how to
Q. How do I set or change Linux system password?
A. Both Linux and UNIX use passwd command to change user password.
passwd changes passwords for user and group accounts. A normal user may only change the password for his/her own account, the super user may change the password for any account. The administrator of a group may change the password for the group. passwd also changes account information, such as the full name of the user, user's login shell, or password expiry date and interval.
Task: Set or change user password
Type passwd command as follows>
$ passwdOutput:
Changing password for vivek (current) UNIX password: Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
The user is first prompted for his/her old password, if one is present. This password is then encrypted and compared against the stored password. The user has only one chance to enter the correct password. The super user is permitted to bypass this step so that forgotten passwords may be changed.
A new password is tested for complexity. As a general guideline, passwords should consist of 6 to 8 characters including one or more from each of following sets:
=> Lower case alphabetics
=> Upper case alphabetics
=> Digits 0 thru 9
=> Punctuation marks
Task: Change for any user
You must login as root user, type the command to change password for user vivek:
# passwd vivekOutput:
Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
Where,
- vivek - is username or account name.
Task: Change group password
When the -g option is used, the password for the named group is changed. For example change password for group sales:
# passwd -g sales
The current group password is not prompted for. The -r option is used with the -g option to remove the current password from the named group. This allows group access to all members. The -R option is used with the -g option to restrict the named group for all users.
Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
Related Other Helpful FAQs:
- MySQL Change root Password
- Change MySQL root password
- Freebsd changing password
- What is My root Password for MySQL Database Server?
- Linux locking an account
Discussion on This FAQ
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!


April 24th, 2007 at 7:22 am
Could you help me how to edit the commands before booting in CentOS? I can’t seem to get it right.
choose the desired OS, in this case CentOS then press e for edit then select the kernel then press e again and type space linuxsingle then enter to accept changes, press b for boot. They told me that a prompt will appear but there is none so that i can type passwd to change the password and username. Pls. help me.
February 12th, 2008 at 3:02 am
thanks this help alot