Linux:使文件夹可递归写入而不影响其中文件权限的命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20138097/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Linux: command to make folders recursively writable without affecting the permission of files inside them
提问by Sankar V
Is it possible to make the folders writable recursively without affecting the files inside them using Linux command.
是否可以使用 Linux 命令递归地使文件夹可写而不影响其中的文件。
chmod 777 -R foldername
- will make all folders and files inside the folder writable.
chmod 777 -R foldername
- 将使文件夹内的所有文件夹和文件可写。
We've a website where we do not want the core files of a php framework writable, but at the same time we should be able to add new files.
我们有一个网站,我们不希望 php 框架的核心文件可写,但同时我们应该能够添加新文件。
采纳答案by devnull
You can say:
你可以说:
find foldername -type d -exec chmod 777 {} \;
This would only change the file mode for the directoriesand not the fileswithin those.
这只会更改文件模式的目录,而不是文件中的那些。