使用 chmod 在 Ubuntu 中设置目录文件权限

Hom*_*lli 2 chmod

Ubuntu 的这个(Fedora 命令)的等效命令是什么:

chmod +a "www-data allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
Run Code Online (Sandbox Code Playgroud)

当我在 Ubuntu (10.0.4 LTS) 上尝试上述操作时,我收到错误消息:

chmod: invalid mode: `+a'
Try `chmod --help' for more information.
Run Code Online (Sandbox Code Playgroud)

hri*_*ioa 5

chmod 使用一系列数字条目来设置文件权限而不是字符串。给出的命令的 ubuntu 版本将是

chmod 0755 app/cache app/logs
Run Code Online (Sandbox Code Playgroud)

假设 www-data 是所有者,这应该有效。如果不,

chown www-data.www-data app/cache app/logs
Run Code Online (Sandbox Code Playgroud)

将改变它所以www-data拥有目录。

详细文章:http : //mdshaonimran.wordpress.com/2010/06/13/chmod-change-filefolder-permission-in-ubuntu/

  • [针对 777 权限的一般警告](http://askubuntu.com/questions/20105/for-security-reasons-why-should-var-www-not-have-chmod-777/20110#20110)。 (2认同)