题目描述1
建立用户组
[root@localhost ~]# groupadd -g 2000 shengchan
[root@localhost ~]# groupadd -g 2001 caiwu
[root@localhost ~]# groupadd -g 2002 jishu
[root@localhost ~]# tail -3 /etc/group
shengchan:x:2000:
caiwu:x:2001:
jishu:x:2002:
[root@localhost ~]#
建立用户
[root@localhost ~]# useradd -g shengchan -G jishu,caiwu -u 2000 lee
[root@localhost ~]# useradd -r linux
[root@localhost ~]# useradd -G caiwu westos
[root@localhost ~]# useradd tabadmin
[root@localhost ~]# tail -4 /etc/passwd
lee:x:2000:2000::/home/lee:/bin/bash
linux:x:980:979::/home/linux:/bin/bash
westos:x:2001:2003::/home/westos:/bin/bash
tabadmin:x:2002:2004::/home/tabadmin:/bin/bash
[root@localhost ~]#
[root@localhost ~]# id lee
uid=2000(lee) gid=2000(shengchan) groups=2000(shengchan),2001(caiwu),2002(jishu)
[root@localhost ~]# id westos
uid=2001(westos) gid=2003(westos) groups=2003(westos),2001(caiwu)
[root@localhost ~]#
赋予tabadmin用户权限
[root@localhost ~]# visudo
visudo: /etc/sudoers.tmp unchanged
[root@localhost ~]#
修改密码
[root@localhost ~]# echo westos | passwd --stdin lee
Changing password for user lee.
passwd: all authentication tokens updated successfully.
[root@localhost ~]# passwd -e lee
Expiring password for user lee.
passwd: Success
[root@localhost ~]# passwd -x 30 lee
Adjusting aging data for user lee.
passwd: Success
[root@localhost ~]#
[root@localhost ~]# echo westos | passwd --stdin linux
Changing password for user linux.
passwd: all authentication tokens updated successfully.
[root@localhost ~]# passwd -e linux
Expiring password for user linux.
passwd: Success
[root@localhost ~]# passwd -x 30 linux
Adjusting aging data for user linux.
passwd: Success
[root@localhost ~]#
[root@localhost ~]# echo westos | passwd --stdin westos
Changing password for user westos.
passwd: all authentication tokens updated successfully.
[root@localhost ~]# passwd -e westos
Expiring password for user westos.
passwd: Success
[root@localhost ~]# passwd -x 30 westos
Adjusting aging data for user westos.
passwd: Success
[root@localhost ~]#
[root@localhost ~]# echo westos | passwd --stdin tabadmin
Changing password for user tabadmin.
passwd: all authentication tokens updated successfully.
[root@localhost ~]# passwd -e tabadmin
Expiring password for user tabadmin.
passwd: Success
[root@localhost ~]# passwd -x 30 tabadmin
Adjusting aging data for user tabadmin.
passwd: Success
[root@localhost ~]#
[root@localhost ~]# tail -4 /etc/shadow
lee:$6$OEIx66YxRiFjEkmj$uQfZtCM16GPemUVyOYSpvn7MkV9aPeEGa9DRQU8kkfKwohhqTtjowDHlMXJDQ6nRWA8T9hYk7f1lNEeMfZuPX1:0:0:30:7:::
linux:$6$vT8vw6l9p3RnZquv$dzQ30aPzNmsG9u.wYtNPuCfUuqKBj62nzBdBluPWn35AJh6uNIp849SJkoeosJZNndr2gAlSCPAnnF0IbfWoT1:0::30::::
westos:$6$rvrvZor0jV.la/8e$WoL9tEdrKcNnxrcbYnDrxBJWXj6HAhRkywS.yDiQqByu0F66pdlS7mCdnTLwmfFinpJkbhoZFWgiBop3sAb7Z0:0:0:30:7:::
tabadmin:$6$2RHz.B657WFI5U5E$D0xBdt9heZqiTaTJMa.GLlS/InaZCZnKm1Y/w7pVhmBaESscE4aV5I2AoLvcoSMd1sZn.i73WolswP.ekfNpW.:0:0:30:7:::
[root@localhost ~]#
题目描述2
建立目录
[root@localhost ~]# mkdir /sc
[root@localhost ~]# chown -R root:shengchan /sc/
[root@localhost ~]# chmod 2770 /sc
[root@localhost ~]# ls -ld /sc
drwxrws---. 2 root shengchan 6 Oct 27 18:06 /sc
[root@localhost ~]#
[root@localhost ~]# mkdir /cw
[root@localhost ~]# chown -R root:caiwu /cw
[root@localhost ~]# chmod 2770 /cw
[root@localhost ~]# ls -ld /cw
drwxrws---. 2 root caiwu 6 Oct 27 18:09 /cw
[root@localhost ~]#
[root@localhost ~]# mkdir /js
[root@localhost ~]# chown -R root:jishu /js
[root@localhost ~]# chmod 2770 /js
[root@localhost ~]# ls -ld /js
drwxrws---. 2 root jishu 6 Oct 27 18:10 /js
[root@localhost ~]#
[root@localhost ~]# mkdir /pub
[root@localhost ~]# chmod 777 /pub
[root@localhost ~]# ls -ld /pub
drwxrwxrwx. 2 root root 6 Oct 27 18:12 /pub
[root@localhost ~]#
赋予tabadmin用户权限
[root@localhost ~]# visudo
visudo: /etc/sudoers.tmp unchanged
[root@localhost ~]#
标签:tabadmin,lee,账户,passwd,练习,westos,Linux,root,localhost
From: https://blog.csdn.net/weixin_73921499/article/details/143271397