3.4 usermod命令
usermod 更改用户属性的命令
usermod -u 111 username 切换user的uid
u g d s
uid gid 家目录 shell

-g后面可以是gid也可以是组名
-s /sbin/nologin username 加一个shell
usradd -G 扩展组
id aming 查看用户的id,uid gid,以及组的内容,除了gid之外的其他组,叫做扩展组
-g只允许一个组,G的话可以多个组
用id 命令查看
或者是!id

3.5 用户密码管理
passwd set_uid 可以使用普通用户修改root用户密码
passwd直接回车
passwd aming修改普通用户密码
!!代表空密码,无法登录。或者是* 好也是无法登录

passwd -l 是锁定一个用户密码
tail /etc/shadow
下面密码位置有两个!!,表示密码已经锁定了
passwd -u aming
解锁密码

密码那里的!!消失

usermod -L aming
tail /etc/shadow

passwd --stdin user5 更改user5 的密码
可能会在以后写shell脚本的时候用到

使用管道符号将前面的结果传送到后面命令

echo -e "123\nsss"表示换行
echo -e "12311111\n12311111" |passwd user3 直接更改密码成功,无需两次输入

合格密码 设定
最少十位,含大小写,数字,特殊符号
没有生日,身份证,姓名等
3.6 mkpasswd命令
生成密码工具
mkpasswd make password
yum install -y expect 可以生成随机的字符串,keepass的记录密码的工具
mkpasswd -l 12 指定密码长度
mkpasswd -l 12 -s 0 或者3 数字是生成的密码指包含特殊符号的数量

网友评论