Linux实验——fourst homework

[root@localhost ~]# mkdir /caomei
[root@localhost /]# useradd yonghu1
[root@localhost /]# useradd yonghu2
[root@localhost /]# chmod o-r /caomei
[root@localhost /]# ll / |grep caomei
drwxr-x--x.   2 root root    6 Nov 24 18:36 caomei
[root@localhost ~]# mkdir /pub
[root@localhost ~]# useradd s1
[root@localhost ~]# useradd s2
[root@localhost ~]# chmod o+t /pub
[root@localhost ~]# chmod o+w /pub
[root@localhost ~]# su - s1
[s1@localhost ~]$ touch /pub/111
[s1@localhost ~]$ exit
logout
[root@localhost ~]# su - s2
[s2@localhost ~]$ rm /pub/111 
rm: remove write-protected regular empty file '/pub/111'? y
rm: cannot remove '/pub/111': Operation not permitted
[s2@localhost ~]$ ll /pub
total 0
-rw-rw-r--. 1 s1 s1 0 Nov 24 19:17 111
[root@localhost ~]# mkdir /sc
[root@localhost ~]# ll / |grep sc
drwxr-xr-x.   2 root root    6 Nov 24 19:19 sc
[root@localhost ~]# chmod g+w /sc
[root@localhost ~]# chmod g+s /sc
[root@localhost ~]# groupadd shengchan
[root@localhost ~]# chown root:shengchan /sc
[root@localhost ~]# useradd -G shengchan renyuan
[root@localhost ~]# su - renyuan
[renyuan@localhost ~]$ touch /sc/qwe
[renyuan@localhost ~]$ ll /sc
total 0
-rw-rw-r--. 1 renyuan shengchan 0 Nov 24 19:25 qwe
[root@localhost ~]# mkdir /cw
[root@localhost ~]# ll / |grep cw
drwxr-xr-x.   2 root root         6 Nov 24 19:29 cw
[root@localhost ~]# chmod 2775 /cw
[root@localhost ~]# groupadd caiwu
[root@localhost ~]# chown root:caiwu /cw
[root@localhost ~]# ll / |grep cw
drwxrwsr-x.   2 root caiwu        6 Nov 24 19:29 cw
[root@localhost ~]# chmod u+s /usr/bin/touch
[root@localhost ~]# su - s1
[s1@localhost ~]$ touch /sc/111
[s1@localhost ~]$ rm /sc/111
rm: remove write-protected regular empty file '/sc/111'? y
rm: cannot remove '/sc/111': Permission denied
[s1@localhost ~]$ ll /sc
total 0
-rw-rw-r--. 1 root    shengchan 0 Nov 24 19:37 111
-rw-rw-r--. 1 renyuan shengchan 0 Nov 24 19:25 qwe

你可能感兴趣的:(网络,linux,服务器)