Unix 系统 staff 组 和 wheel 组的权限拷贝


原先网站程序放置在 /private/website ,目的是防止重装系统,网站程序文件夹被还原。但后台得知应该放到 ~/ 目录更合适?

使用 mv /private/website ~/ ,搬迁成功,可问题是 ls -ll ,权限没有变。


 ben:~ soul$ ls -ll
total 0
drwx------+ 39 soul  staff  1326  9  4 19:45 Desktop
drwx------+  4 soul  staff   136  8 30 21:53 Documents
drwx------+ 15 soul  staff   510  9  3 08:48 Downloads
drwx------@ 49 soul  staff  1666  8 30 14:46 Library
drwx------+  3 soul  staff   102  8 27 20:00 Movies
drwx------+  4 soul  staff   136  8 27 22:14 Music
drwx------+  5 soul  staff   170  9  4 15:39 Pictures
drwxr-xr-x+  5 soul  staff   170  8 27 20:00 Public
drwxr-xr-x   3 root  wheel   102  9  1 23:00 demo
drwxr-xr-x   4 root  wheel   136  8 30 23:48 localhost
drwxr-xr-x   2 root  wheel    68  8 30 22:39 website
ben:~ soul$

1)win系统是为了避免重装的时候c盘数据被还原,所以重要数据不放c盘。Mac是如何原则
2)如何快速将 ~/Picture 的权限拷贝到 ~/website 上?
3)wheel 和 staff 对文本编辑软件打开的影响

权限 macosx

ade123 8 years, 9 months ago

如果你已经把文件拷过去了,那么可以通过 chmod chown 更改权限和所有者:


 chmod -R 755 ~/website
chown -R soul:staff ~/website

如果你还没拷过去,可以通过 -p 参数来同时拷贝所有者、权限、时间戳:


 sudo cp -rp /private/website ~/website

这种问题去查手册就可以知道,比如 man cp 可以看到 -p 参数的介绍:


 -p     same as --preserve=mode,ownership,timestamps

 --preserve[=ATTR_LIST]
          preserve the specified attributes (default: mode,ownership,timestamps),
          if possible additional attributes: context, links, xattr, all

早睡早起身体好 answered 8 years, 9 months ago

Your Answer