1. 讓普通用戶能使用/tmp/cat去查看/etc/shadow文件
1 2 3 4 5
|
| [root@www tmp]# cp -pv $(which cat) /tmp `/bin/cat' -> `/tmp/cat' [root@www tmp]# ll cat -rwxr-xr-x. 1 root root 48568 Oct 15 2014 cat [root@www tmp]# chmod u+s /tmp/cat |
2. 創建目錄/test/data,讓某組內普通用戶對其有寫權限,且創建的所有文件的屬組爲目錄所屬的組,此外,每個用戶僅能刪除自己的文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
| [root@www tmp]# mkdir -pv /test/data mkdir: created directory `/test' mkdir: created directory `/test/data' [root@www tmp]# ll -d /test/data drwxr-xr-x. 2 root root 4096 Sep 25 16:42 /test/data [root@www tmp]# groupadd datagrp [root@www tmp]# useradd datausr [root@www tmp]# id datausr uid=509(datausr) gid=512(datausr) groups=512(datausr) [root@www tmp]# usermod -G datagrp datausr [root@www tmp]# chmod g+w,g+s,o+t /test/data [root@www tmp]# !ll ll -d /test/data drwxrwsr-t. 2 root root 4096 Sep 25 16:42 /test/data |