Linux系統配置及服務管理_第03章用戶管理

大家好,我是霸王卸甲,昨天因爲工作上的事情,忘記更了,今天上午補上昨天的文章,每週週六週日停更兩天。

1.用戶/組基本概念: ①概念:Users and groups:
. Every process (running program) on the system runs as a particular user.
. Every file is owned by a particular user.
. Access to files and directories are restricted by user.
. The user associated with a running process determines the files and directories accessible to that process.
②查看當前登錄的用戶信息:Linux系統配置及服務管理_第03章用戶管理

                                                               ③查看文件的owner:[root@tianyun ~]# ll /home/   
                                                                         drwx------. 4 alice alice 4096 Jun 2 15:59 alice   
                                                                         drwx------. 2 root root 16384 Jun 1 23:09 lost+found    
                                                                         drwxr-xr-x 2 root root 4096 Jun 2 15:33 tianyun

                                                                         ④查看運行進程的username:USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND   
                                                                         root 1 0.0 0.0 19360 1536 ? Ss 13:29 0:00 /sbin/init      
                                                                         root 2 0.0 0.0 0 0 ? S 13:29 0:00 [kthreadd]    
                                                                         root 3 0.0 0.0 0 0 ? S 13:29 0:00 [migration/0]  root 4 0.0 0.0 0 0 ? S 13:29 0:00 [ksoftirqd/0]

2.用戶/組管理:首先給大家講的是用戶如下圖Linux系統配置及服務管理_第03章用戶管理

然後是用戶組:用戶組又分爲基本組和附加組
1創建用戶
#useradd testA
#useradd testB

2 查看用戶UID/GID
#cat /etc/passwd
testA:X:1000:1000 (UID:GID-基本組ID)
testB:X:1001:1001

3 創建個新組,查詢組ID爲1002.
#groupadd groupT
#cat /etc/group
goutpT::1002:

4 請用“usermod -g”修改用戶的基本組爲1002.
#usermod -g groupT testA

5 查詢用戶GID,由1000,更改爲1002
#cat /etc/passwd
testA:X:1000:1002 (UID:GID-基本組ID)
testB:X:1001:1001

附加組:1創建用戶
#useradd testA
#useradd testB
2 查看組信息
#cat /etc/group
testA::1001:
testB::1002:
3 將用戶加入其他組。
語法 -G 附加組 組名 用戶名
usermod -G testB testA
4 查看附加組的成員
#cat /etc/group
testA::1001:
testB::1002:testA(用戶)

提權(瞭解):這個部分大家瞭解下就可以了、
Linux系統配置及服務管理_第03章用戶管理

                                **今天的文章就到這裏了,感謝大家的支持,在這裏給大家道個歉,因爲本人感冒,文章內容結構會整理的不太好,請大家多多包容,謝謝大家,明天見。**
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章