免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
论坛 操作系统 BSD ACL 疑问
最近访问板块 发新帖
查看: 2047 | 回复: 2
打印 上一主题 下一主题

[FreeBSD] ACL 疑问 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-05-05 15:27 |只看该作者 |倒序浏览
 ACL 可以在挂接时通过选项 acls 来启动, 它可以加入 /etc/fstab。另外, 也可以通过使用 tunefs( 修改超级块中的 ACL 标记来持久性地设置自动的挂接属性。 一般而言, 后一种方法是推荐的做法, 其原因是:

    *     挂接时的 ACL 标记无法被重挂接 (mount( -u) 改变, 只有完整地 umount( 并做一次新的 mount( 才能改变它。这意味着 ACL 状态在系统启动之后就不可能在 root 文件系统上发生变化了。 另外也没有办法改变正在使用的文件系统的这个状态。
    *     在超级块中的设置将使得文件系统总被以启用 ACL 的方式挂接, 即使在 fstab 中的对应项目没有作设置, 或设备顺序发生变化时也是如此。 这避免了不慎将文件系统以没有启用 ACL 的状态挂接, 从而避免没有强制 ACL 这样的安全问题。

以上是从handbook中看到的。
当我在vmware安装 freebsd7.2后,也希望使用后一种方法。

#tunefs -a enable /var
tunefs: ACLs set
tunefs: /dev/da0s1d : failed to write superblock

这是为何呢?

同时,我执行setfacl也失败。

除了前一种方法(修改/etc/fstab并重新mount)外;后一种方法,为什么执行失败???

论坛徽章:
2
亥猪
日期:2014-03-19 16:36:35午马
日期:2014-11-23 23:48:46
2 [报告]
发表于 2009-05-05 21:38 |只看该作者
sysctl kern.geom.debugflags=16
sysctl kern.geom.label.debug=16

试试

论坛徽章:
0
3 [报告]
发表于 2009-05-05 22:03 |只看该作者
首先,谢谢楼上的回复。
可惜,好像不对。

还是自己来解决!终于找到答案了:

You simply need to decide on which filesystem(s) you wish to use ACLs:

# df
Filesystem  1K-blocks    Used   Avail Capacity  Mounted on
/dev/ad0s1a    253678   35764  197620    15%    /
devfs               1       1       0   100%    /dev
/dev/ad0s1e    253678      22  233362     0%    /tmp
/dev/ad0s1f   8077406 3045460 4385754    41%    /usr
/dev/ad0s1d    253678   21048  212336     9%    /var

On my system, I wanted to enable ACLs only for users, so I configured only the /usr filesystem.

The FreeBSD handbook explains the advantages of using the tunefs command to enable ACLs. The disadvantage is that it requires bringing the system down to single-user mode and unmounting the filesystem. Choose a time that will least impact users; once you're sure no one is connected to the system, use the following:

# shutdown now
Enter full pathname of shell or RETURN for /bin/sh:

# /sbin/umount /usr
# /sbin/tunefs -a enable /dev/ad0s1f
tunefs: ACLs set
# /sbin/mount /usr

Use your output from df to know the name of the device on which you wish to enable ACLs (-a).

Then, to see if it worked:

# /sbin/mount
/dev/ad0s1a on / (ufs, local)
devfs on /dev (devfs, local)
/dev/ad0s1e on /tmp (ufs, local, soft-updates)
/dev/ad0s1f on /usr (ufs, local, soft-updates, acls)
/dev/ad0s1d on /var (ufs, local, soft-updates)

And to bring the system back to multiuser mode:

# exit

That's it. ACLs are now enabled on /usr.


=================================================
剩下的事儿就是使用setfacl 。

回头想想,难怪这么好用的freebsd在国内使用范围不广,原因。。。。。。

建议和我一样曾经遇到、现在还在疑惑某些问题的朋友,多多浏览英文网站吧!结果会超出你的想象。仅仅是多花些时间而已。

这个坛子有个精典的现象:80%的人路过、20%的人可能会回帖!继续支持freebsd !!!

评分

参与人数 1可用积分 +5 收起 理由
gvim + 5 谢谢分享

查看全部评分

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP