Linux [拓展权限管理]

linux拥有3个特殊的拓展权限管理参数:

 

  对文件影响 对目录影响
suid      以文件所有者的权限运行 Nothing
sgid       以文件所属组的权限运行 目录中的文件继承目录的组
sticky Nothing 对于组有w权限的用户,只能在目录中创建或者修改自己拥有的文件(所属user为自己),但是不能修改或者删除其他用户的文件(虽然同组,并且组具有w权限)

 

suid例子: /etc/password

sgid, sticky例子:

groupadd testgroup

useradd -G testgroup ethan
useradd -G testgroup john

su ethan

mkdir testdir

chgrp testgroup testdir
chown ethan testdir

chmod u+s testdir

cd testdir

touch file1   # have the same group as its dir -- testgroup

chown ethan file1
chmod u+w file1  # group testgroup has w permission

su john # change user to john

cd /testdir

touch file2 # OK, you have the permission

rm -f file1 # permission denied, because of sticky 
posted @ 2014-07-24 14:58  EthanChou  阅读(179)  评论(0)    收藏  举报