码迷,mamicode.com
首页 > 系统相关 > 详细

Linux [拓展权限管理]

时间:2014-07-24 17:07:35      阅读:249      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   文件   io   width   re   c   

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

Linux [拓展权限管理]

标签:style   blog   color   文件   io   width   re   c   

原文地址:http://www.cnblogs.com/ethanchou/p/3865649.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!