简体   繁体   English

linux chmod所有主要目录

[英]linux chmod all leading directories

Do we have a way to 'chmod' all leading directories in linux? 我们是否可以在Linux中“ chmod”所有主要目录?

For example, 例如,

when the permission of 'flex' directory in the path '/local_home/my_home/flex/source' is set to 000, 当路径“ / local_home / my_home / flex / source”中“ flex”目录的许可设置为000时,

chmod 755 /local_home/my_home/flex/source/ will fail due to the permission of 'flex' directory. chmod 755 / local_home / my_home / flex / source /将由于“ flex”目录的许可而失败。

I want to change all permissions of directories presented in the second parameter of 'chmod' command. 我想更改“ chmod”命令第二个参数中显示的目录的所有权限。

Do we have the solution? 我们有解决方案吗?

Thank you in advance. 先感谢您。

You should use the chmod command as root user or as a sudoer (sudo chmod ...) otherwise it fails. 您应该以root用户或sudoer(sudo chmod ...)的身份使用chmod命令,否则它将失败。 If you use: 如果您使用:

sudo chmod 755 /path/to/flex

the permission reflects only on the 'flex' directory. 该权限仅反映在“ flex”目录上。 If you want to set the permission to all of his (flex) child files and directories you should use the '-R' option, which stands for recursively. 如果要对他的所有(灵活)子文件和目录设置权限,则应使用“ -R”选项,该选项表示递归。 In this case your command will like this: 在这种情况下,您的命令将如下所示:

sudo chmod -R 755 /path/to/flex

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM