首页 > 解决方案 > `find \( -perm -04000 -o -perm -02000 \)` 是什么意思

问题描述

我知道这个:

find . -perm -664

       Search  for  files which have read and write permission for their owner and group, 
and which other users can read.

但我无法弄清楚 and 的含义0400002000也许lsattr可以告诉我?但我也不知道。

谢谢。

标签: linuxshellpermissionsfindbit

解决方案


我得出的结论是,下面的两个命令都给出了相同的输出:

SUID权限搜索命令:

  • find / -perm -u=s -type f -ls 2>/dev/null
  • find / -perm -04000 -type f -ls 2>/dev/null

并且:

SGID权限搜索命令:

  • find / -perm -g=s -type f -ls 2>/dev/null
  • find / -perm -02000 -type f -ls 2>/dev/null

因此find \( -perm -04000 -o -perm -02000 \)正在寻找 SUID 和 SGID 的权限位。此处的文档:https ://www.gnu.org/software/libc/manual/html_node/Permission-Bits.html


推荐阅读