如何找到仅拥有所有者特定权限的文件? [英] 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.
我可能会做类似的事情:
I may do something like:
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屋!