手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

Linux基本知识点总结——ACL权限设置

[日期:2013-03-19] 来源:Linux社区  作者:sunshyfangtian [字体:大 中 小]
实验二
 
在实验一的基础上,
 
要求:用户组admins(包括sqa和sqb两个用户)对dirtest没有写权限,但用户sqb有写权限。
 
解决方法:使用acl赋予用户组admins 权限为r-x,赋予用户sqa权限为rwx
 
 
 
1.在实验一中,对于dirtest文件夹,用户sqa权限为---,是acl控制的;用户sqb权限为rwx,不是acl控制的;
 
现在先对用户组admins设置acl
 
[root@itpro ~]# setfacl -m g:admins:r-x /dirtest/
 
[root@itpro ~]# getfacl /dirtest/
 
getfacl: Removing leading '/' from absolute path names
 
# file: dirtest/
 
# owner: root
 
# group: root
 
user::rwx
 
user:sqa:---
 
group::r-x
 
group:admins:r-x
 
mask::r-x
 
other::rwx
 
(注:此时,用户sqa的权限仍然是---,用户sqb的权限则随用户组admins为r-x
 
测试结果如下:
 
[root@itpro ~]# su sqa
 
[sqa@itpro root]$ ls /dirtest/
 
ls: cannot open directory /dirtest/: Permission denied
 
[sqa@itpro root]$ exit
 
exit
 
[root@itpro ~]# su sqb
 
[sqb@itpro root]$ ls /dirtest/
 
t01  t02
 
[sqb@itpro root]$ touch /dirtest/t03
 
touch: cannot touch `/dirtest/t03': Permission denied
 
[sqb@itpro root]$ exit
 
exit
 
[root@itpro ~]#
 
以上是测试结果)
 
 
 
2.删除实验一中对用户sqa设置的acl
 
(注:在实验一步骤2中,使用命令setfacl -m u:sqa:--- /dirtest/ 对用户sqa设置了权限)
 
[root@itpro ~]# setfacl -x u:sqa /dirtest/
 
[root@itpro ~]# getfacl /dirtest/
 
getfacl: Removing leading '/' from absolute path names
 
# file: dirtest/
 
# owner: root
 
# group: root
 
user::rwx
 
group::r-x
 
group:admins:r-x
 
mask::r-x
 
other::rwx
 
(注:如果没有做实验一,直接做实验二,对用户组admins设置acl后,看到的结果便是这个,当然,other权限默认应为r-w,实验一中改了)linux
相关资讯       ACL权限  Linux基本知识点总结 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款