我怎么能找到文件,只有某些允许所有者?

时间:2022-01-20 15:06:24

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 

But what should I put after -perm if I want to ignore the permission of root and other users.

但是我应该怎么把烫后如果我想忽视根用户和其他用户的权限。

2 个解决方案

#1


58  

Start with:

开始:

find /path/to/file -user user1 -perm -u+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 permission string) and the users permissions are only: rwx

这意味着:寻找文件从/道路/ /文件,属于user1,权限组和其他可以是任何权限字符串前面的(-)和用户权限只:特权

Also, try some reading. This has great examples: Find tutorial

同时,尝试一些阅读。这伟大的例子:找到教程

#2


8  

-perm -mode

烫模式

All of the permission bits mode are set for the file. Symbolic modes are accepted in this form, and this is usually the way in which would want to use them. You must specify 'u', 'g' or 'o' if you use a symbolic mode.

所有的文件权限位模式设置。象征性的方式接受这种形式,这是通常的方式想要使用它们。您必须指定‘u’,‘g’或‘o’如果你使用一个象征性的模式。

find . -user $(whoami) -perm -007

for the specified user, it returns files with the following privileges: rwx,

对于指定的用户,它返回具有以下特权的文件:rwx,

find . -user $(whoami) -perm -006

for the specified user, it returns files with the following privileges: rwx, rw,

对于指定的用户,它返回具有以下特权的文件:rwx、rw、

find . -user $(whoami) -perm -005

for the specified user, it returns files with the following privileges: rwx, rx,

为指定的用户,它返回文件以下特权:rwx,处方,

find . -user $(whoami) -perm -004

for the specified user, it returns files with the following privileges: rwx, rw, rx, r,

对于指定的用户,它返回具有以下特权的文件:rwx, rw, rx, r,

find . -user $(whoami) -perm -003

for the specified user, it returns files with the following privileges: rwx, wx,

对于指定的用户,它返回具有以下特权的文件:rwx, wx,

find . -user $(whoami) -perm -002

for the specified user, it returns files with the following privileges: rwx, rw, wx, w,

对于指定的用户,它返回具有以下特权的文件:rwx, rw, wx, w,

find . -user $(whoami) -perm -001

for the specified user, it returns files with the following privileges: rwx, rx, wx, x,

对于指定的用户,它返回具有以下特权的文件:rwx、rx、wx、x,

find . -user $(whoami) -perm -000

for the specified user, it returns files with the following privileges: rwx, rw, rx, wx, r, w, x, 0,

为指定的用户,它返回文件以下特权:rwx,rw,rx,天气,r,w,x,0,

-perm /mode

烫/模式

Any of the permission bits mode are set for the file. Symbolic modes are accepted in this form. You must specify 'u', 'g' or 'o' if you use a symbolic mode. See the EXAMPLES section for some illustrative examples. If no permission bits in mode are set, this test matches any file (the idea here is to be consistent with the behaviour of -perm -000).

为文件设置任何权限位模式。符号模式以这种形式被接受。如果使用符号模式,则必须指定'u'、'g'或'o'。请参见示例部分,以了解一些示例。如果模式中没有设置权限位,则该测试匹配任何文件(此处的想法是与-perm -000的行为一致)。

find . -user $(whoami) -perm /007

for the specified user, it returns files with the following privileges: rwx, rw, rx, wx, r, w, x,

对于指定的用户,它返回具有以下特权的文件:rwx、rw、rx、wx、r、w、x、

find . -user $(whoami) -perm /006

for the specified user, it returns files with the following privileges: rwx, rw, rx, wx, r, w,

对于指定的用户,它返回具有以下特权的文件:rwx、rw、rx、wx、r、w,

find . -user $(whoami) -perm /005

for the specified user, it returns files with the following privileges: rwx, rw, rx, wx, r, x,

对于指定的用户,它返回具有以下特权的文件:rwx、rw、rx、wx、r、x,

find . -user $(whoami) -perm /004

for the specified user, it returns files with the following privileges: rwx, rw, rx, r,

对于指定的用户,它返回具有以下特权的文件:rwx, rw, rx, r,

find . -user $(whoami) -perm /003

for the specified user, it returns files with the following privileges: rwx, rw, rx, wx, w, x,

对于指定的用户,它返回具有以下特权的文件:rwx、rw、rx、wx、w、x,

find . -user $(whoami) -perm /002

for the specified user, it returns files with the following privileges: rwx, rw, wx, w,

对于指定的用户,它返回具有以下特权的文件:rwx, rw, wx, w,

find . -user $(whoami) -perm /001

for the specified user, it returns files with the following privileges: rwx, rx, wx, x,

对于指定的用户,它返回具有以下特权的文件:rwx、rx、wx、x,

find . -user $(whoami) -perm /000

for the specified user, it returns files with the following privileges: rwx, rx, rw, wx, r, w, x, 0.

对于指定的用户,它返回具有以下特权的文件:rwx、rx、rw、wx、r、w、x、0。

Examples have been tested.

测试例子。

Source of citations.

引用的来源。

#1


58  

Start with:

开始:

find /path/to/file -user user1 -perm -u+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 permission string) and the users permissions are only: rwx

这意味着:寻找文件从/道路/ /文件,属于user1,权限组和其他可以是任何权限字符串前面的(-)和用户权限只:特权

Also, try some reading. This has great examples: Find tutorial

同时,尝试一些阅读。这伟大的例子:找到教程

#2


8  

-perm -mode

烫模式

All of the permission bits mode are set for the file. Symbolic modes are accepted in this form, and this is usually the way in which would want to use them. You must specify 'u', 'g' or 'o' if you use a symbolic mode.

所有的文件权限位模式设置。象征性的方式接受这种形式,这是通常的方式想要使用它们。您必须指定‘u’,‘g’或‘o’如果你使用一个象征性的模式。

find . -user $(whoami) -perm -007

for the specified user, it returns files with the following privileges: rwx,

对于指定的用户,它返回具有以下特权的文件:rwx,

find . -user $(whoami) -perm -006

for the specified user, it returns files with the following privileges: rwx, rw,

对于指定的用户,它返回具有以下特权的文件:rwx、rw、

find . -user $(whoami) -perm -005

for the specified user, it returns files with the following privileges: rwx, rx,

为指定的用户,它返回文件以下特权:rwx,处方,

find . -user $(whoami) -perm -004

for the specified user, it returns files with the following privileges: rwx, rw, rx, r,

对于指定的用户,它返回具有以下特权的文件:rwx, rw, rx, r,

find . -user $(whoami) -perm -003

for the specified user, it returns files with the following privileges: rwx, wx,

对于指定的用户,它返回具有以下特权的文件:rwx, wx,

find . -user $(whoami) -perm -002

for the specified user, it returns files with the following privileges: rwx, rw, wx, w,

对于指定的用户,它返回具有以下特权的文件:rwx, rw, wx, w,

find . -user $(whoami) -perm -001

for the specified user, it returns files with the following privileges: rwx, rx, wx, x,

对于指定的用户,它返回具有以下特权的文件:rwx、rx、wx、x,

find . -user $(whoami) -perm -000

for the specified user, it returns files with the following privileges: rwx, rw, rx, wx, r, w, x, 0,

为指定的用户,它返回文件以下特权:rwx,rw,rx,天气,r,w,x,0,

-perm /mode

烫/模式

Any of the permission bits mode are set for the file. Symbolic modes are accepted in this form. You must specify 'u', 'g' or 'o' if you use a symbolic mode. See the EXAMPLES section for some illustrative examples. If no permission bits in mode are set, this test matches any file (the idea here is to be consistent with the behaviour of -perm -000).

为文件设置任何权限位模式。符号模式以这种形式被接受。如果使用符号模式,则必须指定'u'、'g'或'o'。请参见示例部分,以了解一些示例。如果模式中没有设置权限位,则该测试匹配任何文件(此处的想法是与-perm -000的行为一致)。

find . -user $(whoami) -perm /007

for the specified user, it returns files with the following privileges: rwx, rw, rx, wx, r, w, x,

对于指定的用户,它返回具有以下特权的文件:rwx、rw、rx、wx、r、w、x、

find . -user $(whoami) -perm /006

for the specified user, it returns files with the following privileges: rwx, rw, rx, wx, r, w,

对于指定的用户,它返回具有以下特权的文件:rwx、rw、rx、wx、r、w,

find . -user $(whoami) -perm /005

for the specified user, it returns files with the following privileges: rwx, rw, rx, wx, r, x,

对于指定的用户,它返回具有以下特权的文件:rwx、rw、rx、wx、r、x,

find . -user $(whoami) -perm /004

for the specified user, it returns files with the following privileges: rwx, rw, rx, r,

对于指定的用户,它返回具有以下特权的文件:rwx, rw, rx, r,

find . -user $(whoami) -perm /003

for the specified user, it returns files with the following privileges: rwx, rw, rx, wx, w, x,

对于指定的用户,它返回具有以下特权的文件:rwx、rw、rx、wx、w、x,

find . -user $(whoami) -perm /002

for the specified user, it returns files with the following privileges: rwx, rw, wx, w,

对于指定的用户,它返回具有以下特权的文件:rwx, rw, wx, w,

find . -user $(whoami) -perm /001

for the specified user, it returns files with the following privileges: rwx, rx, wx, x,

对于指定的用户,它返回具有以下特权的文件:rwx、rx、wx、x,

find . -user $(whoami) -perm /000

for the specified user, it returns files with the following privileges: rwx, rx, rw, wx, r, w, x, 0.

对于指定的用户,它返回具有以下特权的文件:rwx、rx、rw、wx、r、w、x、0。

Examples have been tested.

测试例子。

Source of citations.

引用的来源。