Linux命令find查询suid和sgid

其中“+”和“-”其实一个是逻辑与一个是逻辑或得意思

[root@localhost ~]# find / -perm +4000 -exec ls -ld {} \;

-rwsr-xr-x 1 root root 0 07-05 01:36 /root/file

-rwsr-xr-x 1 root root 71160 2009-12-16 /sbin/umount.nfs4

-rwsr-xr-x 1 root root 71156 2009-12-16 /sbin/mount.nfs

-rwsr-xr-x 1 root root 19184 2010-03-08 /sbin/unix_chkpwd

-rwsr-xr-x 1 root root 71160 2009-12-16 /sbin/mount.nfs4

-rwsr-xr-x 1 root root 71160 2009-12-16 /sbin/umount.nfs

 

[root@localhost ~]# find / -perm -4000 -exec ls -ld {} \;

-rwsr-xr-x 1 root root 0 07-05 01:36 /root/file

-rwsr-xr-x 1 root root 71160 2009-12-16 /sbin/umount.nfs4

-rwsr-xr-x 1 root root 71156 2009-12-16 /sbin/mount.nfs

-rwsr-xr-x 1 root root 19184 2010-03-08 /sbin/unix_chkpwd

-rwsr-xr-x 1 root root 71160 2009-12-16 /sbin/mount.nfs4

-rwsr-xr-x 1 root root 71160 2009-12-16 /sbin/umount.nfs

 

[root@localhost ~]# find / -perm -6000 -exec ls -ld {} \;

-rwsr-sr-x 1 root root 315416 2009-12-11 /usr/bin/crontab

上面的-6000表示既具有suid权限又具有sgid权限的文件,我在linux上查找了只有这个文件,而如果是+6000的话,具有suid或者具有sgid又或者两个权限都具有的文件都会显示出来,在此我也不一一举例了,大家如果感兴趣的话,自己可以多多练习

你可能感兴趣的:(linux命令)