1. 查看系統裡的使用者(USER),可以用 ls /home

2. 也可以用 cat /etc/passwd


這裡解釋最後一行:
test 是使用者(USER) 帳號
x 是密碼
1001 是全域 ID
1002 是GROUP ID
/home/test 是 USER 目錄
/bin/bash 是 USER 使用的 shell
3. 可以用 sudo cat /etc/shadow 來查看USER 密碼內容

4. id [username]
id test

uid: USER ID
gid: GROUP test
groups: 是它屬於的 GROUP ,這裡只屬於 test GROUP
id acc_andrew

這裡的 groups 就有很多了:acc_andrew, adm, dip, video, plugdev
5. groupadd [groupname]
sudo 建立新 GROUP

利用 cat /etc/group 來看

在最下方可以看到新建立的 GROUP student

6. 改換 GROUP
sudo usermod -G student test
再使用 id test 觀察

可以看到 GROUP 多了一個 student
7. 創建 USER 指定 GROUP
sudo useradd -G student test1

請先 登入 以發表留言。