The other answers are correct, in that chmod -R 755
will set these permissions to all files and subfolders in the tree.
(其他答案是正确的,因为chmod -R 755
会将这些权限设置为树中的所有文件和子文件夹。)
But why on earth would you want to ? (但是为什么你想要呢?)
It might make sense for the directories, but why set the execute bit on all the files? (它可能对目录有意义,但为什么要在所有文件上设置执行位?)
I suspect what you really want to do is set the directories to 755 and either leave the files alone or set them to 644. For this, you can use the find
command.
(我怀疑你真正想要做的是将目录设置为755并保留文件或将它们设置为644.为此,您可以使用find
命令。)
For example: (例如:)
To change all the directories to 755 ( drwxr-xr-x
):
(要将所有目录更改为755( drwxr-xr-x
):)
find /opt/lampp/htdocs -type d -exec chmod 755 {} ;
To change all the files to 644 ( -rw-r--r--
):
(要将所有文件更改为644( -rw-r--r--
):)
find /opt/lampp/htdocs -type f -exec chmod 644 {} ;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…