如何找到只对所有者具有特定权限的文件? [英] How can I find files that only have certain permission for owner?
问题描述
我只想通过特定用户的权限查找文件.例如,如果我想查找我拥有完全权限的文件.
I would like to find files only by a certain user's permission. For example, if I want to find a file that I have full permission.
我可能会这样做:
find . -user $(whoami) -perm
但是如果我想忽略root和其他用户的权限,我应该在-perm
后面加上什么.
But what should I put after -perm
if I want to ignore the permission of root and other users.
推荐答案
开始:
find /path/to/file -user user1 -perm -u+rwx
这意味着:查找从 /path/to/files
开始,由 user1
拥有的文件,其中 group 和 other 的权限可以是任何东西(-
在权限字符串前面),用户权限只有:rwx
This means: look for files starting in /path/to/files
, owned by user1
, where the permissions for group and other can be anything (-
in front of the permission string) and the users permissions are only: rwx
仅搜索文件(无目录)然后添加 -type f
.
To search for files only (no directories) then add -type f
.
另外,请尝试阅读.这有很好的例子:查找教程
Also, try some reading. This has great examples: Find tutorial
这篇关于如何找到只对所有者具有特定权限的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!