[root@linux-128 ~]# cat /etc/passwd root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt mail:x:8:12:mail:/var/spool/mail:/sbin/nologin operator:x:11:0:operator:/root:/sbin/nologin games:x:12:100:games:/usr/games:/sbin/nologin ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin nobody:x:99:99:Nobody:/:/sbin/nologin systemd-bus-proxy:x:999:997:systemd Bus Proxy:/:/sbin/nologin systemd-network:x:192:192:systemd Network Management:/:/sbin/nologin dbus:x:81:81:System message bus:/:/sbin/nologin polkitd:x:998:996:User for polkitd:/:/sbin/nologin tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin postfix:x:89:89::/var/spool/postfix:/sbin/nologin sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin chrony:x:997:995::/var/lib/chrony:/sbin/nologin wuzhou:x:1000:1000::/home/wuzhou:/bin/bash
[root@linux-128 ~]# cat /etc/shadow root:$6$zl63r8d5$knNxU6YQDPktVmvQoB82o59nukoj8Kv8.88SfCMPEdLcoaFqwL9VsO0U8Bzh5dfEwP3CRXDU9hbQDhHL44bll/:17458:0:99999:7::: bin:*:17110:0:99999:7::: daemon:*:17110:0:99999:7::: adm:*:17110:0:99999:7::: lp:*:17110:0:99999:7::: sync:*:17110:0:99999:7::: shutdown:*:17110:0:99999:7::: halt:*:17110:0:99999:7::: mail:*:17110:0:99999:7::: operator:*:17110:0:99999:7::: games:*:17110:0:99999:7::: ftp:*:17110:0:99999:7::: nobody:*:17110:0:99999:7::: systemd-bus-proxy:!!:17455:::::: systemd-network:!!:17455:::::: dbus:!!:17455:::::: polkitd:!!:17455:::::: tss:!!:17455:::::: postfix:!!:17455:::::: sshd:!!:17455:::::: chrony:!!:17455:::::: wuzhou:!!:17459:0:99999:7:::
用戶組文件 /etc/grouplinux
例子:shell
[root@linux-128 ~]# groupadd grp1 [root@linux-128 ~]# tail -2 /etc/group slocate:x:21: grp1:x:1001:
[root@linux-128 ~]# groupadd -g 1003 grp2 [root@linux-128 ~]# tail -3 /etc/group slocate:x:21: grp1:x:1001: grp2:x:1003:
[root@linux-128 ~]# groupdel grp1 [root@linux-128 ~]# tail -3 /etc/group wuzhou:x:1000: slocate:x:21: //剛纔建立的用戶grp1已經被刪除 grp2:x:1003:
[root@linux-128 ~]# tail -3 /etc/passwd chrony:x:997:995::/var/lib/chrony:/sbin/nologin wuzhou:x:1000:1000::/home/wuzhou:/bin/bash user1:x:1001:1001::/home/user1:/bin/bash [root@linux-128 ~]# groupdel user1
groupdel:不能移除用戶「user1」的主組 //user1組裏有個用戶user1用戶,因此刪除不了; 若是想要刪除用戶組,必須先刪除組裏的因此用戶,再刪除用戶組。 usebash
[root@linux-128 ~]# useradd user2 [root@linux-128 ~]# tail -1 /etc/passwd user2:x:1002:1002::/home/user2:/bin/bash
[root@linux-128 ~]# tail -1 /etc/group user2:x:1002:
[root@linux-128 ~]# useradd -u 1004 -g 1005 -M -s /sbin/nolongin user3 useradd:「1005」組不存在 [root@linux-128 ~]# useradd -u 1004 -g 1003 -M -s /sbin/nolongin user3 [root@linux-128 ~]# tail -2 /etc/passwd user2:x:1002:1002::/home/user2:/bin/bash user3:x:1004:1003::/home/user3:/sbin/nolongin
[root@linux-128 ~]# cat /home/user3 cat: /home/user3: 沒有那個文件或目錄 [root@linux-128 ~]# ls /home user1 user2 wuzhou
[root@linux-128 ~]# userdel user2 [root@linux-128 ~]# ls /home user1 user2 wuzhou //user2的家目錄還存在 [root@linux-128 ~]# userdel -r user1 [root@linux-128 ~]# ls /home user2 wuzhou //user1家目錄已經刪除