I'm trying to find files with permissions that exceed 755. Using the solution from another post here I have been able to get mostly what I want:
find /bin -type f -perm -755 ! -perm 755
This does ignore anything at 755 or below, but it returns files with the SUID and SGID bits set. I would like to ignore these. Is it possible to do this in one command? I've tried multiple ! -perm
arguments with both 2000
and 4000
but that didn't do anything.
I have also used 2755
and 4755
in sequential commands, but again, I would prefer covering both in one command.
I was thinking the -o
operator would help, but I'm not sure how to do that with an argument that contains a negated pattern like I'm using. I tried it as
find . -type f \(-perm -2755 ! -perm 2755 -o -perm -4755 ! -perm 4755\)
but that just threw the paths must precede expression
error.