Mac OS X 10.6 上的根目录权限?

Ago*_*gos 1 root permissions ownership macos

我想知道根目录 / 应该归“root”所有是否正常。
每次我想在那里做某事(例如保存文件,创建目录)时,我都会被要求输入密码,但我不记得以前发生过这种情况(尽管这可能只是我的记忆错误)。这是相关的终端输出:

MacBook:~ ago$ ls -lah /
total 37311
drwxr-xr-x@  35 root  staff   1,2K 22 Mar 12:34 .
drwxr-xr-x@  35 root  staff   1,2K 22 Mar 12:34 ..
-rw-rw-r--@   1 root  admin    21K 22 Mar 10:21 .DS_Store
drwx------    3 root  admin   102B 28 Feb  2008 .Spotlight-V100
d-wx-wx-wt    2 root  admin    68B 31 Ago  2009 .Trashes
-rw-r--r--@   1 ago   501      45K 23 Gen  2008 .VolumeIcon.icns
srwxrwxrwx    1 root  staff     0B 22 Mar 12:34 .dbfseventsd
----------    1 root  admin     0B 23 Giu  2009 .file
drwx------   27 root  admin   918B 22 Mar 10:55 .fseventsd
-rw-r--r--@   1 ago   admin    59B 30 Ott  2007 .hidden
-rw-------    1 root  wheel   320K 30 Nov 11:42 .hotfiles.btree
drwxr-xr-x@   2 root  wheel    68B 18 Mag  2009 .vol
drwxrwxr-x+ 276 root  admin   9,2K 19 Mar 18:28 Applications
drwxrwxr-x@  21 root  admin   714B 14 Nov 12:01 Developer
drwxrwxr-t+  74 root  admin   2,5K 18 Dic 22:14 Library
drwxr-xr-x@   2 root  wheel    68B 23 Giu  2009 Network
drwxr-xr-x    4 root  wheel   136B 13 Nov 17:49 System
drwxr-xr-x    6 root  admin   204B 31 Ago  2009 Users
drwxrwxrwt@   4 root  admin   136B 22 Mar 12:35 Volumes
drwxr-xr-x@  39 root  wheel   1,3K 13 Nov 17:44 bin
drwxrwxr-t@   2 root  admin    68B 23 Giu  2009 cores
dr-xr-xr-x    3 root  wheel   5,1K 17 Mar 11:29 dev
lrwxr-xr-x@   1 root  wheel    11B 31 Ago  2009 etc -> private/etc
dr-xr-xr-x    2 root  wheel     1B 17 Mar 11:30 home
drwxrwxrwt@   3 root  wheel   102B 31 Ago  2009 lost+found
-rw-r--r--@   1 root  wheel    18M  3 Nov 19:40 mach_kernel
dr-xr-xr-x    2 root  wheel     1B 17 Mar 11:30 net
drwxr-xr-x@   3 root  admin   102B 24 Nov  2007 opt
drwxr-xr-x@   6 root  wheel   204B 31 Ago  2009 private
drwxr-xr-x@  64 root  wheel   2,1K 13 Nov 17:44 sbin
lrwxr-xr-x@   1 root  wheel    11B 31 Ago  2009 tmp -> private/tmp
drwxr-xr-x@  17 root  wheel   578B 12 Set  2009 usr
lrwxr-xr-x@   1 root  wheel    11B 31 Ago  2009 var -> private/var
Run Code Online (Sandbox Code Playgroud)

这些所有权/权限可以吗?我应该 chmod/chown 什么吗?

Gor*_*son 8

我刚刚检查了几个相对干净的 OS X 10.6 Mac,虽然 / 归 root 所有,但它的组和权限与您拥有的不同:它被分配给 admin 组,并且设置了组写入和粘滞位,并且没有扩展属性(即drwxrwxr-t 29 root admin)。磁盘工具的权限修复功能似乎没有重置这个(我刚试过),但你可以手动修复它:

sudo chgrp admin /
sudo chmod 1775 /
xattr -l /
Run Code Online (Sandbox Code Playgroud)

最后一个命令将显示附加到根的扩展属性;根据它们是什么,您可能想要删除它们(使用sudo xattr -d attrname /)。