标签:linux命令基础
命令功能:修改用户登录密码,
命令格式:passwd [username]
常用选项:
举例:
修改root用户密码,(仅root用户有此权限)
passwd
# [root@localhost ~]# passwd
# Changing password for user root.
# New password:
# BAD PASSWORD: it is based on a dictionary word
# Retype new password:
# passwd: all authentication tokens updated successfully.
修改ami用户的登录密码
passwd ami
# [root@localhost ~]# passwd ami
# Changing password for user ami.
# New password:
# BAD PASSWORD: it is based on a dictionary word
# Retype new password:
# passwd: all authentication tokens updated successfully.
echo "amiadmin" | passwd --stdin ami
此种方式可直接修改用户的密码,但风险是history命令可以查看到明文密码
说明:执行passwd不带任何用户名时,修改的是当前登录用户的登录密码,root用户可以修改所有普通用户的密码,普通用户不能修改其他用户的密码
标签:linux命令基础
原文地址:http://wszzdanm.blog.51cto.com/1841747/1711326