Fork me on GitHub

centos7里创建用户和组

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

posted @ 2019-11-18 14:23  Alex-Lzy  阅读(8598)  评论(0编辑  收藏  举报