我们在osx下总是看到目录www的权限是wheel:
AndyMacBookPro:var andy$ ll
total 0
drwxr-xr-x 25 root wheel 850 6 23 09:58 ./
drwxr-xr-x@ 6 root wheel 204 6 21 17:34 ../
drwx------ 2 root wheel 68 8 25 2013 agentx/
drwxr-xr-x 8 daemon wheel 272 6 21 17:19 at/
drwx------ 9 root wheel 306 6 23 09:20 audit/
drwx------ 2 root wheel 68 8 25 2013 backups/
drwxr-xr-x 54 root wheel 1836 6 23 09:23 db/
drwxr-xr-x 2 root sys 68 8 25 2013 empty/
drwxr-xr-x 4 root wheel 136 6 21 17:44 folders/
drwxr-x--- 2 _jabber _jabber 68 8 25 2013 jabberd/
drwxr-xr-x 3 root wheel 102 8 25 2013 lib/
drwxr-xr-x 56 root wheel 1904 6 23 09:20 log/
drwxrwxr-x 2 root mail 68 8 25 2013 mail/
drwxr-xr-x 3 root wheel 102 6 21 17:19 msgs/
drwxr-xr-x 2 root wheel 68 8 25 2013 netboot/
drwxr-xr-x 2 _networkd _networkd 68 8 25 2013 networkd/
drwxr-x--- 5 root wheel 170 6 21 17:41 root/
drwxr-xr-x 4 root wheel 136 8 25 2013 rpc/
drwxrwxr-x 23 root daemon 782 6 23 09:20 run/
drwxr-xr-x 2 daemon wheel 68 8 25 2013 rwho/
drwxr-xr-x 7 root wheel 238 6 21 17:31 spool/
drwxrwxrwt 4 root wheel 136 6 23 09:20 tmp/
drwxr-xr-x 5 root wheel 170 6 23 09:20 vm/
drwxr-xr-x 2 root wheel 68 6 23 09:58 www/
drwxr-xr-x 3 root wheel 102 8 25 2013 yp/
AndyMacBookPro:var andy$
我们看到很多目录的权限分组是wheel,这个wheel属于root分组,所以如果我们在此wheel下进行任何操作的话,都需要root权限才行,也就是每次操作都需要输入root密码,这肯定是不方便的,我们有什么办法能把wheel分组变为admin分组呢?
参考:https://discussions.apple.com/message/10506745
根据老外提供的命令:
sudo chown root:admin /
我们可以 sudo chown root:admin /var/www
来把我们的www目录变为admin分组权限。这样我们就可以随意修改文件夹下的内容。
让我们看一下完整的操作:
AndyMacBookPro:var andy$ ll
total 0
drwxr-xr-x 25 root wheel 850 6 23 09:58 ./
drwxr-xr-x@ 6 root wheel 204 6 21 17:34 ../
drwx------ 2 root wheel 68 8 25 2013 agentx/
drwxr-xr-x 8 daemon wheel 272 6 21 17:19 at/
drwx------ 9 root wheel 306 6 23 09:20 audit/
drwx------ 2 root wheel 68 8 25 2013 backups/
drwxr-xr-x 54 root wheel 1836 6 23 09:23 db/
drwxr-xr-x 2 root sys 68 8 25 2013 empty/
drwxr-xr-x 4 root wheel 136 6 21 17:44 folders/
drwxr-x--- 2 _jabber _jabber 68 8 25 2013 jabberd/
drwxr-xr-x 3 root wheel 102 8 25 2013 lib/
drwxr-xr-x 56 root wheel 1904 6 23 09:20 log/
drwxrwxr-x 2 root mail 68 8 25 2013 mail/
drwxr-xr-x 3 root wheel 102 6 21 17:19 msgs/
drwxr-xr-x 2 root wheel 68 8 25 2013 netboot/
drwxr-xr-x 2 _networkd _networkd 68 8 25 2013 networkd/
drwxr-x--- 5 root wheel 170 6 21 17:41 root/
drwxr-xr-x 4 root wheel 136 8 25 2013 rpc/
drwxrwxr-x 23 root daemon 782 6 23 09:20 run/
drwxr-xr-x 2 daemon wheel 68 8 25 2013 rwho/
drwxr-xr-x 7 root wheel 238 6 21 17:31 spool/
drwxrwxrwt 4 root wheel 136 6 23 09:20 tmp/
drwxr-xr-x 5 root wheel 170 6 23 09:20 vm/
drwxr-xr-x 2 root wheel 68 6 23 09:58 www/
drwxr-xr-x 3 root wheel 102 8 25 2013 yp/
AndyMacBookPro:var andy$ sudo chown root:admin www
AndyMacBookPro:var andy$ ll
total 0
drwxr-xr-x 25 root wheel 850 6 23 09:58 ./
drwxr-xr-x@ 6 root wheel 204 6 21 17:34 ../
drwx------ 2 root wheel 68 8 25 2013 agentx/
drwxr-xr-x 8 daemon wheel 272 6 21 17:19 at/
drwx------ 9 root wheel 306 6 23 09:20 audit/
drwx------ 2 root wheel 68 8 25 2013 backups/
drwxr-xr-x 54 root wheel 1836 6 23 09:23 db/
drwxr-xr-x 2 root sys 68 8 25 2013 empty/
drwxr-xr-x 4 root wheel 136 6 21 17:44 folders/
drwxr-x--- 2 _jabber _jabber 68 8 25 2013 jabberd/
drwxr-xr-x 3 root wheel 102 8 25 2013 lib/
drwxr-xr-x 56 root wheel 1904 6 23 09:20 log/
drwxrwxr-x 2 root mail 68 8 25 2013 mail/
drwxr-xr-x 3 root wheel 102 6 21 17:19 msgs/
drwxr-xr-x 2 root wheel 68 8 25 2013 netboot/
drwxr-xr-x 2 _networkd _networkd 68 8 25 2013 networkd/
drwxr-x--- 5 root wheel 170 6 21 17:41 root/
drwxr-xr-x 4 root wheel 136 8 25 2013 rpc/
drwxrwxr-x 23 root daemon 782 6 23 09:20 run/
drwxr-xr-x 2 daemon wheel 68 8 25 2013 rwho/
drwxr-xr-x 7 root wheel 238 6 21 17:31 spool/
drwxrwxrwt 4 root wheel 136 6 23 09:20 tmp/
drwxr-xr-x 5 root wheel 170 6 23 09:20 vm/
drwxr-xr-x 2 root admin 68 6 23 09:58 www/
drwxr-xr-x 3 root wheel 102 8 25 2013 yp/
AndyMacBookPro:var andy$ sudo chown root:wheel www
AndyMacBookPro:var andy$ ll
total 0
drwxr-xr-x 25 root wheel 850 6 23 09:58 ./
drwxr-xr-x@ 6 root wheel 204 6 21 17:34 ../
drwx------ 2 root wheel 68 8 25 2013 agentx/
drwxr-xr-x 8 daemon wheel 272 6 21 17:19 at/
drwx------ 9 root wheel 306 6 23 09:20 audit/
drwx------ 2 root wheel 68 8 25 2013 backups/
drwxr-xr-x 54 root wheel 1836 6 23 09:23 db/
drwxr-xr-x 2 root sys 68 8 25 2013 empty/
drwxr-xr-x 4 root wheel 136 6 21 17:44 folders/
drwxr-x--- 2 _jabber _jabber 68 8 25 2013 jabberd/
drwxr-xr-x 3 root wheel 102 8 25 2013 lib/
drwxr-xr-x 56 root wheel 1904 6 23 09:20 log/
drwxrwxr-x 2 root mail 68 8 25 2013 mail/
drwxr-xr-x 3 root wheel 102 6 21 17:19 msgs/
drwxr-xr-x 2 root wheel 68 8 25 2013 netboot/
drwxr-xr-x 2 _networkd _networkd 68 8 25 2013 networkd/
drwxr-x--- 5 root wheel 170 6 21 17:41 root/
drwxr-xr-x 4 root wheel 136 8 25 2013 rpc/
drwxrwxr-x 23 root daemon 782 6 23 09:20 run/
drwxr-xr-x 2 daemon wheel 68 8 25 2013 rwho/
drwxr-xr-x 7 root wheel 238 6 21 17:31 spool/
drwxrwxrwt 4 root wheel 136 6 23 09:20 tmp/
drwxr-xr-x 5 root wheel 170 6 23 09:20 vm/
drwxr-xr-x 2 root wheel 68 6 23 09:58 www/
drwxr-xr-x 3 root wheel 102 8 25 2013 yp/
AndyMacBookPro:var andy$
最后老外总结说这明显是unix的一个bug。
另外有网友提供另一个命令:chgrp:
AndyMacBookPro:var andy$ ll
total 0
drwxr-xr-x 25 root wheel 850 6 23 09:58 ./
drwxr-xr-x@ 6 root wheel 204 6 21 17:34 ../
drwx------ 2 root wheel 68 8 25 2013 agentx/
drwxr-xr-x 8 daemon wheel 272 6 21 17:19 at/
drwx------ 9 root wheel 306 6 23 09:20 audit/
drwx------ 2 root wheel 68 8 25 2013 backups/
drwxr-xr-x 54 root wheel 1836 6 23 09:23 db/
drwxr-xr-x 2 root sys 68 8 25 2013 empty/
drwxr-xr-x 4 root wheel 136 6 21 17:44 folders/
drwxr-x--- 2 _jabber _jabber 68 8 25 2013 jabberd/
drwxr-xr-x 3 root wheel 102 8 25 2013 lib/
drwxr-xr-x 56 root wheel 1904 6 23 09:20 log/
drwxrwxr-x 2 root mail 68 8 25 2013 mail/
drwxr-xr-x 3 root wheel 102 6 21 17:19 msgs/
drwxr-xr-x 2 root wheel 68 8 25 2013 netboot/
drwxr-xr-x 2 _networkd _networkd 68 8 25 2013 networkd/
drwxr-x--- 5 root wheel 170 6 21 17:41 root/
drwxr-xr-x 4 root wheel 136 8 25 2013 rpc/
drwxrwxr-x 23 root daemon 782 6 23 09:20 run/
drwxr-xr-x 2 daemon wheel 68 8 25 2013 rwho/
drwxr-xr-x 7 root wheel 238 6 21 17:31 spool/
drwxrwxrwt 4 root wheel 136 6 23 09:20 tmp/
drwxr-xr-x 5 root wheel 170 6 23 09:20 vm/
drwxr-xr-x 2 root wheel 68 6 23 09:58 www/
drwxr-xr-x 3 root wheel 102 8 25 2013 yp/
AndyMacBookPro:var andy$ sudo chgrp admin www
AndyMacBookPro:var andy$ ll
total 0
drwxr-xr-x 25 root wheel 850 6 23 09:58 ./
drwxr-xr-x@ 6 root wheel 204 6 21 17:34 ../
drwx------ 2 root wheel 68 8 25 2013 agentx/
drwxr-xr-x 8 daemon wheel 272 6 21 17:19 at/
drwx------ 9 root wheel 306 6 23 09:20 audit/
drwx------ 2 root wheel 68 8 25 2013 backups/
drwxr-xr-x 54 root wheel 1836 6 23 09:23 db/
drwxr-xr-x 2 root sys 68 8 25 2013 empty/
drwxr-xr-x 4 root wheel 136 6 21 17:44 folders/
drwxr-x--- 2 _jabber _jabber 68 8 25 2013 jabberd/
drwxr-xr-x 3 root wheel 102 8 25 2013 lib/
drwxr-xr-x 56 root wheel 1904 6 23 09:20 log/
drwxrwxr-x 2 root mail 68 8 25 2013 mail/
drwxr-xr-x 3 root wheel 102 6 21 17:19 msgs/
drwxr-xr-x 2 root wheel 68 8 25 2013 netboot/
drwxr-xr-x 2 _networkd _networkd 68 8 25 2013 networkd/
drwxr-x--- 5 root wheel 170 6 21 17:41 root/
drwxr-xr-x 4 root wheel 136 8 25 2013 rpc/
drwxrwxr-x 23 root daemon 782 6 23 09:20 run/
drwxr-xr-x 2 daemon wheel 68 8 25 2013 rwho/
drwxr-xr-x 7 root wheel 238 6 21 17:31 spool/
drwxrwxrwt 4 root wheel 136 6 23 09:20 tmp/
drwxr-xr-x 5 root wheel 170 6 23 09:20 vm/
drwxr-xr-x 2 root admin 68 6 23 09:58 www/
drwxr-xr-x 3 root wheel 102 8 25 2013 yp/
AndyMacBookPro:var andy$ sudo chgrp wheel www
AndyMacBookPro:var andy$ ll
total 0
drwxr-xr-x 25 root wheel 850 6 23 09:58 ./
drwxr-xr-x@ 6 root wheel 204 6 21 17:34 ../
drwx------ 2 root wheel 68 8 25 2013 agentx/
drwxr-xr-x 8 daemon wheel 272 6 21 17:19 at/
drwx------ 9 root wheel 306 6 23 09:20 audit/
drwx------ 2 root wheel 68 8 25 2013 backups/
drwxr-xr-x 54 root wheel 1836 6 23 09:23 db/
drwxr-xr-x 2 root sys 68 8 25 2013 empty/
drwxr-xr-x 4 root wheel 136 6 21 17:44 folders/
drwxr-x--- 2 _jabber _jabber 68 8 25 2013 jabberd/
drwxr-xr-x 3 root wheel 102 8 25 2013 lib/
drwxr-xr-x 56 root wheel 1904 6 23 09:20 log/
drwxrwxr-x 2 root mail 68 8 25 2013 mail/
drwxr-xr-x 3 root wheel 102 6 21 17:19 msgs/
drwxr-xr-x 2 root wheel 68 8 25 2013 netboot/
drwxr-xr-x 2 _networkd _networkd 68 8 25 2013 networkd/
drwxr-x--- 5 root wheel 170 6 21 17:41 root/
drwxr-xr-x 4 root wheel 136 8 25 2013 rpc/
drwxrwxr-x 23 root daemon 782 6 23 09:20 run/
drwxr-xr-x 2 daemon wheel 68 8 25 2013 rwho/
drwxr-xr-x 7 root wheel 238 6 21 17:31 spool/
drwxrwxrwt 4 root wheel 136 6 23 09:20 tmp/
drwxr-xr-x 5 root wheel 170 6 23 09:20 vm/
drwxr-xr-x 2 root wheel 68 6 23 09:58 www/
drwxr-xr-x 3 root wheel 102 8 25 2013 yp/
AndyMacBookPro:var andy$
验证过也可以~~~