『-r--------』
,且擁有者為 root。
『drwxrwxrwt』
,任何用戶都可在 /tmp 內新增、修改檔案,但僅有該檔案/目錄建立者與 root 能夠刪除自己的目錄或檔案。
ls -l
列出檔案屬性,如:
rwsrw-r--
表示設置 SUID 屬性rwxrwsrw-
表示設置 SGID 屬性rwxrw-rwt
表示設置 SBIT 屬性
x
屬性,則這些特殊屬性顯示為小寫字母 (s, s, t)
,否則顯示為大寫字母 (S, S, T)
。
rwx
屬性之設定類似:
foo
的屬性。
[root@dywHome2 test]# chmod 4755 foo; ll foo -rwsr-xr-x 1 root root 7 Sep 4 13:25 foo* [root@dywHome2 test]# chmod 6755 foo; ll foo -rwsr-sr-x 1 root root 7 Sep 4 13:25 foo* [root@dywHome2 test]# chmod 1755 foo; ll foo -rwxr-xr-t 1 root root 7 Sep 4 13:25 foo* [root@dywHome2 test]# chmod 7666 foo; ll foo -rwSrwSrwT 1 root root 7 Sep 4 13:25 foo
[root@dywHome2 test]# ll /usr/bin/passwd; ls -ld /var/spool/mail;\ >ls -ld /tmp -r-s--x--x 1 root root 15552 May 8 2006 /usr/bin/passwd* drwxrwsr-x 2 root mail 1024 Aug 3 2006 /var/spool/mail/ drwxrwxrwt 26 root root 2048 Sep 4 15:51 /tmp/
練習題
rwsrw-r--
,表示該檔具有那種特殊屬性?
rwxrwsr--
,表示該檔具有那種特殊屬性?
rwxrw-r-t
,表示該檔具有那種特殊屬性?
chmod 4755 foo; ll foo
,則顯示檔案 foo 屬性為何?
-rwsr-xr-x
chmod 6755 foo; ll foo
,則顯示檔案 foo 屬性為何?
-rwsr-sr-x
chmod 1755 foo; ll foo
,則顯示檔案 foo 屬性為何?
-rwxr-xr-t
chmod 4666 foo; ll foo
,則顯示檔案 foo 屬性為何?
-rwSrw-rw-
chmod 2666 foo; ll foo
,則顯示檔案 foo 屬性為何?
-rw-rwSrw-
chmod 1666 foo; ll foo
,則顯示檔案 foo 屬性為何?
-rw-rw-rwT