According to locate the file permissions

**

According to locate the file permissions

**

Find by file permissions, need to use -perm options, depending on the setting conditions for permissions, this option is divided into three uses:

l -perm mode: exact mode matching condition indicated.

l -perm / mode: Any one type of user (Ugo) rights in any one (rwx) Matching mode can be represented, between 9 rights "or" relationship.

l -perm -mode: Every (rwx) any type of user (ugo) permission to be in the mode at the same time meet the conditions indicated, there is "and" the relationship between nine privileges.

For example, to look in the / boot directory permissions for regular files 755, and display detailed information. We set the search criteria as "-perm 755", can be found in two documents were found, the authority of these two documents are to find conditions were an exact match.

[root@localhost ~]# find /boot -perm 755 -type f -ls

 65030  250 -rwxr-xr-x   1 root   root  254248 4月 7  2015 /boot/efi/EFI/redhat/grub.efi

 16 4125 -rwxr-xr-x  1 root  root  4222192 7月 2 2015 /boot/vmlinuz-2.6.32-573.el6.x86_64

In addition to read and write permissions to perform these conventional addition, Linux system also provides a special privileges and SUID SGID, their corresponding numbers are 4 and 2, respectively. If you want to find all the SUID files on your system, you should specify the conditions "-perm -4000".

[root@localhost ~]# find / -perm -4000 –ls 2> /dev/null
788976   40 -rwsr-xr-x   1 root     root        38200 12月 11  2014 /bin/ping
788990   76 -rwsr-xr-x   1 root     root        77336 8月 11  2014 /bin/mount

Guess you like

Origin blog.csdn.net/weixin_43803070/article/details/94759234