3.2通配符、用户管理

4、请总结描述用户和组管理类命令的使用方法并完成以下练习:

   (1)、创建组distro,其GID为2019;

   (2)、创建用户mandriva, 其ID号为1005;基本组为distro;

   (3)、创建用户mageia,其ID号为1100,家目录为/home/linux;

   (4)、给用户mageia添加密码,密码为mageedu,并设置用户密码7天后过期

   (5)、删除mandriva,但保留其家目录;

   (6)、创建用户slackware,其ID号为2002,基本组为distro,附加组peguin;

   (7)、修改slackware的默认shell为/bin/tcsh;

   (8)、为用户slackware新增附加组admins;

(1)

[root@C7-64-Mini ~]# groupadd -g 2019 distro

(2)

[root@C7-64-Mini ~]# useradd -u 1005 -g distro mandriva

[root@C7-64-Mini ~]# id mandriva

uid=1005(mandriva) gid=2019(distro) groups=2019(distro)

(3)

[root@C7-64-Mini ~]# useradd -u 1100 -d /home/linux mageia

[root@C7-64-Mini ~]# id mageia

uid=1100(mageia) gid=1100(mageia) groups=1100(mageia)

[root@C7-64-Mini ~]# ll /home/linux -d

drwx------. 2 mageia mageia 62 Nov 19 21:52 /home/linux

(4)

root@C7-64-Mini ~]# passwd mageia

Changing password for user mageia.

New password: 

BAD PASSWORD: The password is shorter than 8 characters

Retype new password: 

passwd: all authentication tokens updated successfully.

[root@C7-64-Mini ~]# passwd -i +7 mageia

Adjusting aging data for user mageia.

passwd: Success

[root@C7-64-Mini ~]# cat /etc/shadow | grep mageia

mageia:$6$adlm2OGu$gcAIURRp2D4mqFyB5Rg180GHgY9gP6aWBL3j0kz6abniobGAXC26lX2xODzs1WWo.1pkOCJWm0suFgBzLc1wE.:18219:0:99999:7:7::

(5)

[root@C7-64-Mini ~]# userdel mandriva

[root@C7-64-Mini ~]# ll /home/mandriva -d

drwx------. 2 1005 distro 62 Nov 19 21:50 /home/mandriva

(6)

[root@C7-64-Mini ~]# groupadd peguin

[root@C7-64-Mini ~]# useradd -u 2002 -g distro -G peguin slackware

[root@C7-64-Mini ~]# id slackware

uid=2002(slackware) gid=2019(distro) groups=2019(distro),2020(peguin)

(7)

[root@C7-64-Mini ~]# usermod -s /bin/tcsh slackware

(8)

[root@C7-64-Mini ~]# useradd admins

[root@C7-64-Mini ~]# usermod -G admins slackware

[root@C7-64-Mini ~]# id slackware

uid=2002(slackware) gid=2019(distro) groups=2019(distro),2003(admins)

[root@C7-64-Mini ~]# usermod -G admins,peguin  slackware

[root@C7-64-Mini ~]# id slackware

uid=2002(slackware) gid=2019(distro) groups=2019(distro),2020(peguin),2003(admins)



上一篇:【STM32F429】第22章 ThreadX动态内存管理


下一篇:C6 C7的开机启动流程