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

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

[日期:2013-03-19] 来源:Linux社区  作者:sunshyfangtian [字体:大 中 小]
方法2,使用tune2fs –o acl命令进行设置(tune2fs用于调整和查看文件系统的参数)
 
这种方法,在设置时,并不生效,需要重启系统才生效,也会带来不便。
 
 
 
[root@itpro ~]# tune2fs -l /dev/mapper/vg_itpro-lv_root |grep acl
 
Default mount options:    user_xattr acl
 
[root@itpro ~]# tune2fs -l /dev/mapper/vg_itpro-lv_data |grep acl
 
(注:lv_root分区的查询结果为user_xattracl,表示支持acl;而lv_data分区的查询结果为空,表示默认值不支持acl)
 
[root@itpro ~]# tune2fs -o acl /dev/mapper/vg_itpro-lv_data
 
tune2fs 1.41.12 (17-May-2010)
 
[root@itpro ~]# tune2fs -l /dev/mapper/vg_itpro-lv_data |grep acl
 
Default mount options:    acl
 
(注:手动给lv_data分区设置acl支持)
 
 
 
此时acl是不生效的,需要系统重启才生效,并且永久生效
 
[root@itpro ~]# setfacl -m u:sqa:rwx /data/
 
setfacl: /data/: Operation not supported
 
[root@itpro ~]# init 6
 
……重启,重新登录……
 
[root@itpro ~]# setfacl -m u:sqa:rwx /data/
 
[root@itpro ~]# setfacl –b
 
 
 
如果要恢复为不支持acl,
 
[root@itpro ~]# tune2fs -o ^acl /dev/mapper/vg_itpro-lv_data
 
tune2fs 1.41.12 (17-May-2010)
 
[root@itpro ~]# tune2fs -l /dev/mapper/vg_itpro-lv_data |grep acl
 
(注:acl前面用了取反符号“^”;查询结果为空,表示acl取消了,这个设置也是要系统重启才能生效)
 
 
 
方法3,修改/etc/fstab文件
 
最有用的方法,相当于在方法1的基础上,修改fstab文件,使系统重启时加载acl。
 
在/etc/fstab文件,lv_data条目中,在defaults后面追加acl选项,修改后内容如下:
 
[root@itpro ~]# cat /etc/fstab
 
# /etc/fstab
 
/dev/mapper/vg_itpro-lv_root /                      ext4    defaults        1 1
 
/dev/mapper/vg_itpro-lv_data /data                  ext4    defaults,acl        0 0
 
……省略部分输出……
 
 
 
修改完成后,使用-o remount选项,重新读取分区表信息,acl即时生效,并且永久生效。
 
[root@itpro ~]# mount -o remount /dev/mapper/vg_itpro-lv_data
 
[root@itpro ~]# setfacl -m u:sqa:rwx /data/
 
[root@itpro ~]# setfacl -b /data/linux
相关资讯       ACL权限  Linux基本知识点总结 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

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