- usermod命令,用户密码管理,makpasswd
usermod是更改用户的属性
[[email protected] ~]# usermod -u 1002 suer 更改uid
[[email protected] ~]# usermod -g 1008 user2 更改gid
[[email protected] ~]# usermod -d /home/user 指定家目录
[[email protected] ~]# usermod -s /bin/bash user 指定它的shell
[[email protected] ~]# usermod -G 增加扩展组
[[email protected] ~]# id dabaitu
uid=1000(dabaitu) gid=1000(dabaitu) groups=1000(dabaitu)
[[email protected] ~]# usermod -G user3 dabaitu dabaitu还属于user3组
[[email protected] ~]# id dabaitu
uid=1000(dabaitu) gid=1000(dabaitu) groups=1000(dabaitu),1006(user3)
usermod -G 还可以继续增加到组里
paaawd
root更改密码 直接passwd直接后面什么都不用跟
[[email protected] ~]# passwd dabaitu 更改普通用户的密码
Changing password for user dabaitu.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[[email protected] ~]# tail -n7 /etc/shadow
tcpdump:!!:17394::::::
dabaitu:$6$HatndKWn$s44muqDhFKSZ/BoyoLdCz5bblzmvtZKPA607lE.uLmi2OF4Kc30B4GBou6omch0iK4mEtk8UsWGRBO76PgzuQ0:17470:0:99999:7:::
user:$6$bjgUYnNf$e1UL.8QIlOG9BF8J4JDicsP7re5nS0w6UOKv8RwK75re9nK0BQ0.Xqw4d/ZHC8wcFQbY1SI8mXjjYRZKNikL1/:17469:0:99999:7:::
两个 !! 是空密码 用户不可以登录
*号是密码被锁定的 不能用的
[[email protected] ~]# passwd -l dabaitu 锁定一个用户的 选项
[[email protected] ~]# usermod -L user 锁定一个用户
[[email protected] ~]# usermod -U user 解锁
[[email protected] ~]# passwd --stdin dabaitu --stdin的用法 密码明文显示
Changing password for user dabaitu.
[email protected]
passwd: all authentication tokens updated successfully.
[[email protected] ~]# echo -e "122\nss" echo的两种用法
122
ss
[[email protected] ~]# echo -e "122\tnss"
122 nss
makepasswd
[[email protected] ~]# yum install -y expect 安装这个包
[[email protected] ~]# mkpasswd -l 12 -s 3 l密码长度 s特殊符号