一、练习
1.创建用户gentoo,附加组为distro和linux,默认shell为/bin/csh,用户注释信息为“Gentoo Distribution” ?
[root@wybaron_host1015 ~]# groupadd distro
[root@wybaron_host1015 ~]# groupadd linux
[root@wybaron_host1015 ~]# useradd -G distro,linux -s /bin/csh -c "Gentoo Distribution" gentoo
[root@wybaron_host1015 ~]# id gentoo
uid=1000(gentoo) gid=1002(gentoo) 组=1002(gentoo),1000(distro),1001(linux)
[root@wybaron_host1015 ~]# cat /etc/passwd | grep "Gent"
gentoo:x:1000:1002:Gentoo Distribution:/home/gentoo:/bin/csh
2.为gentoo用户设置密码为gentoo,设置指定每次密码的最短使用期限为7天,最大为15天,提前3天开始警告 ?
# 生产环境中,我们应该抛弃此种设置密码的方式,此方式易造成密码泄露
[root@wybaron_host1015 ~]# echo "gentoo" | passwd -n 7 -x 15 -w 3 --stdin gentoo
调整用户密码老化数据gentoo。
passwd: 操作成功
[root@wybaron_host1015 ~]# chage -l gentoo
最近一次密码修改时间 :9月 16, 2018
密码过期时间 :10月 01, 2018
密码失效时间 :从不
帐户过期时间 :从不
两次改变密码之间相距的最小天数 :7
两次改变密码之间相距的最大天数 :15
在密码过期之前警告的天数 :3
二、补充
shell(壳):shell是用户与系统“沟通”的接口,和权限相关信息是两个不同的概念,不同的shell只是用户登录后使用的命令和语法不同而已。其一般在系统的/bin目录下。
shell类别及其路径
类别 | 路径 |
---|---|
ash | /bin/ash |
sh | /bin/sh |
bash | /bin/bash |
csh | /bin/csh |
ksh | /bin/ksh |
tcsh | /bin/tcsh |
zsh | /bin/zsh |