分区根目录的权限默认应该是怎么样的?

2015-05-01 14:31:03 +08:00
 cuthead

里面权限是不同的,到底哪个才是对的?
2011 次点击
所在节点    macOS
10 条回复
Autonomous
2015-05-01 15:01:46 +08:00
对于已启用所有者的宗卷,其宗卷根目录的
所有者为root:wheel
权限应为755
ItzhacLea
2015-05-01 18:46:14 +08:00
第三个是最接近的,但即使如此,wheel 的权限也仅为read only
cuthead
2015-05-01 20:55:52 +08:00
@Autonomous
@ItzhacLea 怎么用Terminal修正这个问题?
popbones
2015-05-01 21:01:16 +08:00
@cuthead man chmod
Autonomous
2015-05-01 21:58:06 +08:00
@cuthead
sudo chown -R root:wheel #file destination#
sudo chmod -R 755 #file destination#
Autonomous
2015-05-01 21:59:40 +08:00
@cuthead before you apply those commands, disable 'Ignore ownership on this volume' is required.
cuthead
2015-05-01 23:33:58 +08:00
@Autonomous 如何显示分区的permission和ownership?ls -l只显示文件列表的权限。中间图显示组成员是staff是怎么回事?为什么可以同时用system和user的个人权限?如何改权限的人的名字用Terminal
Autonomous
2015-05-01 23:48:06 +08:00
@cuthead 首先要保证宗卷被正常挂载,然后cd /volumes
接着ls -al就可以看到相关宗卷的所有者/所有者所在的组/对应权限。
chown命令用于更改所有者:所有者对应的组。 因为一个用户可以隶属于多个组,所以除了指定所有者外还要指定一个组。一般来说宗卷根目录是由root账户和wheel组所有。因此sudo chown -R root:wheel

chmod命令用于修改权限,7表示rwx(即读写+执行),5表示r-x(直读+执行)。
Autonomous
2015-05-01 23:50:37 +08:00
5楼的命令有一个错误! 我不应该加-R的,这里用递归会导致整个宗卷包括其子文件夹/文件都会被改掉权限。其实应该仅应用于宗卷根目录即可。
cuthead
2015-05-02 18:44:07 +08:00
@Autonomous 问题解决,多谢解答,原来还得改所有者。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/187762

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX