如何找到只有所有者具有特定权限的文件? [英] 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屋!