V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
cuthead
V2EX  ›  macOS

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

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

    chmod命令用于修改权限,7表示rwx(即读写+执行),5表示r-x(直读+执行)。
    Autonomous
        9
    Autonomous  
       2015-05-01 23:50:37 +08:00
    5楼的命令有一个错误! 我不应该加-R的,这里用递归会导致整个宗卷包括其子文件夹/文件都会被改掉权限。其实应该仅应用于宗卷根目录即可。
    cuthead
        10
    cuthead  
    OP
       2015-05-02 18:44:07 +08:00
    @Autonomous 问题解决,多谢解答,原来还得改所有者。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   892 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 23:05 · PVG 07:05 · LAX 16:05 · JFK 19:05
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.