1.创建组distro,其GID为2019
groupadd -g 2019 distro

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

useradd mandriva -u 1005 -g distro
3.创建用户mageia,其ID号为1100,家目录为/home/linux
useradd -u 1100 -d /home/linux mageia

4.给用户mageia添加密码,密码为mageedu,并设置用户密码7天后过期
passwd mageia
Changing password for user mageia.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

5.删除mandriva,但保留其家目录
 userdel mandriv

6.创建用户slackware,其ID号为2002,基本组为distro,附加组peguin

1)groupadd peguin

2)useradd slackware -u 2002 -g distro -G peguin

7.修改slackware的默认shell为/bin/tcsh

chsh slackware
Changing shell for slackware.
New shell [/bin/bash]: /bin/tcsh
Shell changed.

8.为用户slackware新增附加组admins

usermod -aG admins slackware

05-16 06:48