Environment
RedHat Linux 9 + VWWare 7.1.2 + Putty 0.62
Problem
Change User Password in Linux
Solution
Method 1
1. If you log on as a normal user, change your password and use the passwd command. You will be asked to enter your old password and then enter the new password twice.
[Www.bkjia.com @ localhost root] $ passwd
Changing password for user wgb.
Changing password for wgb
(Current) UNIX password:
New password:
Retype new password:
Passwd: all authentication tokens updated successfully.
[Www.bkjia.com @ localhost root] $
[Www.bkjia.com @ localhost root] $ passwd wgb
Passwd: Only root can specify a user name.
2. If you log on as a root user, use passwd root or passwd to change the root password. Enter the new password twice.
[Root @ localhost root] # passwd
Changing password for user root.
New password:
Bad password: it is too short
Retype new password:
Passwd: all authentication tokens updated successfully.
[Root @ localhost root] #
[Root @ localhost root] # passwd root
Changing password for user root.
New password:
Bad password: it is too short
Retype new password:
Passwd: all authentication tokens updated successfully.
[Root @ localhost root] #
Method 2
Log on as the root user, open the terminal, and execute echo "password you want to set" | passwd -- stdin User Name
[Root @ localhost root] # echo "wgb" | passwd -- stdin wgb
Changing password for user wgb.
Passwd: all authentication tokens updated successfully.