user:: user: 属主权限 "::"均为属主 ":" 为特殊用户
[root@nagios test]# touch setuid setgid sticky
[root@nagios test]# chown -R nagios.nagios ./
[root@nagios test]# chmod u+s setuid && chmod g+s setgid && chmod o+t sticky
[root@nagios test]# ll
total 0
-rw-r-Sr-- 1 nagios nagios 0 Mar 2800:41 setgid
-rwSr--r-- 1 nagios nagios 0 Mar 2800:41 setuid
-rw-r--r-T 1 nagios nagios 0 Mar 2800:41 sticky
[root@nagios test]# su hello
[hello@nagios test]$ pwd
/root/test
[hello@nagios test]$ echo hello >> setuid
bash: setuid: Permission denied
[hello@nagios test]$ sh setuid
hello
[nagios@nagios test]$ exit
exit
[root@nagios test]# chmod o+w sticky
[root@nagios test]# su hello
[hello@nagios test]$ ll sticky
-rw-rw-rwT 1 nagios nagios 0 Mar 2800:45 sticky
[hello@nagios test]$ rm sticky
rm: cannot remove `sticky': Permission denied
[hello@nagios test]$ stat sticky
File: `sticky'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: fd00h/64768d Inode: 134198 Links: 1
Access: (1666/-rw-rw-rwT) Uid: ( 500/ nagios) Gid: ( 500/ nagios)
Access: 2013-03-2800:45:37.875928997 +0800
Modify: 2013-03-2800:45:37.875928997 +0800
Change: 2013-03-2800:46:28.050580800 +0800
[root@nagios heelo]# tune2fs -l /dev/sda1 | grep option
Default mount options: user_xattr acl
Chattr +-=[acdeijstuADST].
[root@nagios test]# touch setfacl
[root@nagios test]# setfacl -m user::r,user:hello:rw setfacl
[root@nagios test]# chown nagios.nagios setfacl
[root@nagios test]# ll setfacl
-r--rw-r--+ 1 nagios nagios 0 Mar 2800:52 setfacl
[root@nagios test]# su nagios
[nagios@nagios test]$ echo hello >> setfacl
bash: setfacl: Permission denied
[nagios@nagios test]$ exit
exit
[root@nagios test]# su hello
[hello@nagios test]$ echo hello >> setfacl
[hello@nagios test]$ cat setfacl
hello
[hello@nagios test]$ getfacl setfacl
# file: setfacl
# owner: nagios
# group: nagios
user::r--
user:hello:rw-
group::r--
mask::rw-
other::r--
#chattr and lsattr
[root@nagios test]# mkdir chattr
[root@nagios test]# chattr +i chattr/
[root@nagios test]# touch chattr/hello
touch: cannot touch `chattr/hello': Permission denied
[root@nagios test]# chattr -i +a chattr/
[root@nagios test]# touch chattr/hello && echo hello >>chattr/hello && cat chattr/hello
hello
[root@nagios test]# rm chattr/hello
rm: remove regular file `chattr/hello'? y
rm: cannot remove `chattr/hello': Operation not permitted