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.
- Email FAQ to a friend
- Printable version
- Rss Feed
- Last Updated: 9-21-06
{ 6 comments… read them below or add one }
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.
thanks this help alot
hi!
I am Aloka . I am student of computer science & I have linux on my machine.
i forgotten the username & password of it.
can u help me for this for changing the username & password.
plz help me.
Go to linux rescue mode (single user mode) at the boot prompt when the linux image is loaded and reset your password through the prompt.
Hey, i want to set my password so that when my linux laptop starts up, my account name comes up and i have to type my password in so that others cannot access my account settings without my password. Help me please!? x
Hi
As a root user I want to reset lost of passwords and want to set each users password with a single command i.e. not have to be asked to type passwords afterwords. So the command needs to include the new password and not require the old one.
Help would be greatly appreciated