环境
RedHat Linux 9 + VWWare 7.1.2 + Putty 0.62
问题
Linux更改用户密码
解决
方法一
1.如果你是以普通用户登录的话,修改自己的密码,使用passwd命令。会让你先输入自己的旧密码,再输入两遍新密码。
[www.linuxidc.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.linuxidc.com@localhost root]$
[www.linuxidc.com@localhost root]$ passwd wgb
passwd: Only root can specify a user name.
2.如果你是root用户登录的话,使用passwd root或者passwd,就可以修改root的密码。直接输入两遍新密码就可以了,不用输入旧密码。
[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]#
方法二
root用户登录,打开终端,执行 echo “你想设置的密码” | passwd –stdin 用户名
[root@localhost root]# echo “wgb” | passwd –stdin wgb
Changing password for user wgb.
passwd: all authentication tokens updated successfully.