組管理和許可權管理

2022-03-09 00:07:33 字數 874 閱讀 4925

1:檢視檔案的所有者

ls -ahl 簡寫ll

ll lu.txt

-rw-r--r-- 1 root root 27 5月 21 18:25 lu.txt

2:修改檔案所有者

chown 使用者名稱 檔名

chown luo lu.txt

root@luo-xia:/tmp# ll lu.txt

-rw-r--r-- 1 luo root 27 5月 21 18:25 lu.txt

3:修改檔案所在的組

chgrp 組名 檔名

4:查詢所有使用者資訊

cat /etc/passwd

5:查詢某個使用者

cat /etc/passwd|grep 使用者名稱

6:查詢所有組資訊

cat /etc/group

adm:x:4:syslog,luo

adm 使用者組。

x 使用者組口令。

4 cid

syslong,luo 這個該使用者所包含的使用者。

7:查詢luo在哪個組下或者luo這個組的資訊

cat /etc/group|grep luo

8:groups 檢視當前登入使用者的組內成員

groups test 檢視test使用者所在的組,以及組內成員

whoami 檢視當前登入使用者名稱

root@luo-xia:/# groups

root

root@luo-xia:/# groups luo

luo : luo adm cdrom sudo dip plugdev lpadmin sambashare

root@luo-xia:/# whoami

root

組管理和許可權管理

檢視檔案的所有者 ls ahl rw r r 1 root root 49 1月 2 17 28 abc.txtchown 使用者名稱 檔名 chown tom abc.txt 將 home test目錄下的所有檔案和目錄的所有者改為tom chown r tom home testgroupadd...

Linux 組管理和許可權管理

檔案屬性 這些字元分別表示 如果沒有許可權,就會出現減號 而已。從左至右用0 9這些數字來表示 0首位表示型別 在linux中第乙個字元代表這個檔案是目錄 檔案或鏈結檔案等等 代表檔案 d代表目錄 l鏈結文件 link file 2 第1 3位確定屬主 該檔案的所有者 擁有該檔案的許可權。user ...

Linux 組管理和許可權管理

一般為檔案的建立者,誰建立了該檔案,就自然的稱為該檔案的所有者。當某個使用者建立了乙個檔案之後,預設之歌檔案所在組就是該使用者所在的組 除檔案的所有者和所在組的使用者外,系統的其他使用者都是檔案的其他組 在linux中第乙個字元代表這個檔案是目錄 檔案或鏈結檔案等等。接下來的字元中,以三個為一組,且...