About Linux FAQ

Browse More FAQs:

Linux set or change user password how to

Posted by Vivek Gite [Last updated: September 21, 2006]

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:

Discussion on This FAQ

  1. bambi Says:

    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.

  2. Rick Says:

    thanks this help alot

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!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.