Linux [拓展权限管理]

时间:2014-07-24 17:07:35   收藏:0   阅读:249

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 

Linux [拓展权限管理],布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!