特殊文件权限
[root@rhel6 data]# touch test test1 test4
[root@rhel6 data]# mkdir test2
[root@rhel6 data]# chmod 1644 test1 "1=o+t,即设置sbit"
[root@rhel6 data]# chmod 2755 test2 "2=g+s,即设置sgid"
[root@rhel6 data]# chmod 4755 test4 "4=u+s,即设置suid"
[root@rhel6 data]# ll
-rw-r--r-- 1 root root 0 10-25 09:55 test
-rwxrwxrwt 1 root root 0 10-25 09:55 test1
drwxr-sr-x 2 root root 4096 10-25 09:55 test2
-rwsr-xr-x 1 root root 0 10-25 09:55 test4
[root@rhel6 data]# su - xfcy ;cd /data/
[xfcy@rhel6 data]$ rm test1
rm: 无法删除 “test1”: 权限不够 //设置了sticky位,即使用户对文件具有写权限,也不能删除该文件
[xfcy@rhel6 data]$ touch test2/test2
[xfcy@rhel6 data]$ ll test2/test2
-rw-rw-r-- 1 xfcy root 0 10-25 10:31 test2/test2 //设置了SGID,任何用户在此目录下创建的文件都具有和该目录所属的组相同的组
[xfcy@rhel6 data]$ ll /usr/bin/passwd
-rwsr-xr-x 1 root root 27768 2006-07-17 /usr/bin/passwd
[xfcy@rhel6 data]$ passwd &
[xfcy@rhel6 data]$ ps -ef | grep passwd
root 11340 11308 0 10:35 pts/0 00:00:00 /usr/bin/passwd //设置了SUID,使文件在执行阶段具有文件所有者的权限