3.2通配符、用戶管理

四、請總結描述用戶和組管理類命令的使用方法並完成如下練習:
linux

   (1)、建立組distro,其GID爲2019;
shell

   (2)、建立用戶mandriva, 其ID號爲1005;基本組爲distro;
app

   (3)、建立用戶mageia,其ID號爲1100,家目錄爲/home/linux;
ide

   (4)、給用戶mageia添加密碼,密碼爲mageedu,並設置用戶密碼7天后過時
ui

   (5)、刪除mandriva,但保留其家目錄;加密

   (6)、建立用戶slackware,其ID號爲2002,基本組爲distro,附加組peguin;
spa

   (7)、修改slackware的默認shell爲/bin/tcsh;
orm

   (8)、爲用戶slackware新增附加組admins;token

(1)
it

[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)

相關文章
相關標籤/搜索