Heim > Fragen und Antworten > Hauptteil
查找具有SUID or SGID权限的文件
我自己构造的命令是find / -type f -perm u+s,g+s
搜索了一下(https://www.google.co.jp/webh...
好像命令是find directory -user root -perm -4000
find $DIRECTORY -perm /4000
有几点不理解:
其他权限设置成0, 与我的要求有点不符合吧? (其他权限随意)
为什么要加一个/
?
记不住SUID的数字, 用其他方式书写,怎么写?
Linux-Server
系统自带find
伊谢尔伦2017-04-17 15:39:17
man find
-perm mode
File's permission bits are exactly mode (octal or symbolic). Since an exact match is required, if you want to use this form for symbolic modes, you may have to specify a rather complex mode string. For example `-perm g=w' will
only match files which have mode 0020 (that is, ones for which group write permission is the only permission set). It is more likely that you will want to use the `/' or `-' forms, for example `-perm -g=w', which matches any file
with group write permission. See the EXAMPLES section for some illustrative examples.
-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 you would want to use them. You must specify `u', `g' or `o' if you use a symbolic mode. See
the EXAMPLES section for some illustrative examples.
-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 permis‐
sion bits in mode are set, this test matches any file (the idea here is to be consistent with the behaviour of -perm -000).
所以,确切匹配为: -perm mode
,只匹配模式为 mode 的文件,加 /
为 or 匹配, -
为 and 匹配。其他书写方式:-perm -u+s,g+s
-perm /u+s,g+s