Linux 學習:Linux特殊權限習題

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章