ACL 可以在挂接时通过选项
acls
来启动, 它可以加入
/etc/fstab。另外, 也可以通过使用 修改超级块中的
ACL 标记来持久性地设置自动的挂接属性。 一般而言, 后一种方法是推荐的做法
一、可以对/etc/fstab进行修改使之开启acl
如: /dev/ad0s1d /var ufs rw,acls 2 2
重启后即获得。
二、用tunefs启用文件系统acl的方法:
1、在系统启动时选用4 Boot FreeBSD in single user mode,此时系统只mount了‘/’和devfs。
2、然后就可以根据需要使用tunefs调整filesystem的acl。根据/etc/fstab的内容,具体命令可以是这样(仅供参考):
#tunefs -a enable /dev/ad0s1a
#tunefs -a enable /dev/ad0s1f
等等。
如果想看操作的结果,就:
#tunefs -p /dev/ad0s1f
tunefs: ACLs: (-a) enabled
证明此卷已经启用acl。
3、之后按正常方式重新启动系统,登录,各系统都挂接了,就可以使用setfacl和getfacl了。
setfacl [-bdhkn] [-m entries] [-M file] [-x entries] [-X file] [file ...]
给用户user1在文件xxxx.xxxx加上读、写权限。
setfacl -m user:user1:rw /root/xxxx.xxxx
读取xxxx.xxxx的acl属性
getfacl xxxx.xxxx
#file:xxxx.xxxx
#owner:root
#group:wheel
user::rw-
group::r--
mask::rw-
other::r--
备注:
1、系统内核需要支持acl,内核配置文件用options UFS_ACL,如果未支持此选项需要重新编译内核。
2、对于已挂接的文件系统,使用tunefs通常是不好使的。需要先卸载文件系统,然后再tunefs调整才可以启用acl,再回复至正常Mount状态。
3、tunefs为调整文件系统的工具,上面的功能仅为其中一项,还包括调整磁盘文件系统的其他参数
The tunefs utility is designed to change the dynamic parameters of a file system which affect the layout policies. The tunefs utility cannot be run on an active file system. To change an active file system, it must be downgraded to read-only or unmounted.
阅读(1828) | 评论(1) | 转发(0) |