chmod-将用户权限复制到组/世界 [英] chmod - replicate user permissions to group/world
本文介绍了chmod-将用户权限复制到组/世界的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要使某些文件夹/文件(递归)具有与用户相同的权限。因此:
I have a need to make some folders/files (recursive) have the same permissions as that of the user. So:
- 0755-> 0777
- 0644-> 0666
我该怎么做?
如果没有简单的方法,那么也许我需要创建一个循环并测试/分配。最终,我只需要处理3种类型:
If there is no easy way then perhaps I would need to create a loop and test/assign. Ultimately I only need to deal with 3 types:
文件夹应该是777,大多数文件是666,可执行文件是777。
Folders should be 777, most files 666, executables 777.
推荐答案
查找
可以完成查找具有给定权限集的文件并运行尽可能少的 chmod
调用即可满足要求。
find
can do the work of finding files with a given permission set and running the smallest possible number of chmod
invocations necessary to cover them.
find . \
'(' -perm -0700 -exec chmod 0777 '{}' + ')' -o \
'(' -perm -0600 -exec chmod 0666 '{}' + ')'
这篇关于chmod-将用户权限复制到组/世界的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文