特殊許可權suid sgid sticky

2021-09-20 18:01:16 字數 1983 閱讀 6754

4  suid:當乙個檔案的宿主有s許可權,意味著任何使用者在執行此程式時,其程序不再屬於其執行者,而屬於這個程式檔案的屬主。  用於可執行檔案。例:/usr/bin/passwd

2  sgid:

1  sticky:  在該目錄下的檔案,僅檔案擁有人和root使用者可刪。

1

2

3

4

[root@localhost tmp]# id user1

uid=501(user1) gid=501(user1)groups=501(user1),504(gtest)

[root@localhost tmp]# id user2

uid=502(user2) gid=502(user2)groups=502(user2),504(gtest)

1

2

3

[root@localhost tmp]# ls -l

total 4

drwxr-xr-x. 2 root gtest 4096 aug 14 08:21 dirtest

1

2

3

4

[root@localhost tmp]# chmod g+w dirtest/

[root@localhost tmp]# ls -l

total 4

drwxrwxr-x. 2 root gtest 4096 aug 14 11:44 dirtest

1

2

3

4

[user1@localhost dirtest]$ls-l

total 0

-rw-rw-r--. 1 user2 user2 0 aug 14 12:09 a.user2

-rw-rw-r--. 1 user1 user1 0 aug 14 12:10 b.user1

user1使用者和user2使用者不能修改彼此建立的檔案,無寫的許可權。

把目錄dirtest加上sgid的許可權之後,user1和user2在此資料夾中建立的檔案都會屬於資料夾dirtest的屬組,相互之間就可以修改彼此的檔案了。

1

2

3

4

5

6

[root@localhost tmp]# ls -l dirtest/

total 0

-rw-rw-r--. 1 user2 user2 0 aug 14 12:09 a.user2

-rw-rw-r--. 1 user1 user1 0 aug 14 12:10 b.user1

-rw-rw-r--. 1 user2 gtest 0 aug 14 12:20 b.user2

-rw-rw-r--. 1 user1 gtest 0 aug 14 12:20 c.user1

linux特殊許可權SUID,SGID,sticky

一 為什麼要使用特殊許可權?比如系統中假如有超過四類人然而每一類人都需要一種獨特許可權.只有三種獨特許可權的基礎許可權系統就會明顯不夠用.特殊許可權可以擴充套件系統基礎許可權的功能,使得linux許可權更加強大靈活 二 suid rwsr xr x.1 root root 30768 2月 22 2...

linux高階許可權suid sgid sticky

1.分析以下問題 root w hat ll root file1.txt rw r r 1 root root 0 aug 4 16 13 root file1.txt sfj1 w hat cat root file1.txt cat root file1.txt permission deni...

許可權和特殊許可權

許可權 1 對限 a 三者 u 擁有者 屬主 g 基礎組 主組 屬組 0 其他人 讀 寫 執行 讀 寫 執行 讀 寫 執行 許可權位共九位 r w x r w x r w x u g o 列 u rwx 擁有者具有讀寫執行的許可權 g r x 基本組具有讀和執行的許可權 o r 其他人只具有讀的許可...