Operating System - HP-UX
1827835 Members
8783 Online
109969 Solutions
New Discussion

finding files with set guid set

 
SOLVED
Go to solution
Janice Bradford
Occasional Contributor

finding files with set guid set

Can anyone give me the syntax for finding files with the "set guid" set? I have tried several times with the find command using:
find / -type f -perm -g=xxx -print

Any help is appreciated.
9 REPLIES 9
Peter Nikitka
Honored Contributor
Solution

Re: finding files with set guid set

Hi,

find -type f -perm -2000 -print

will list all plain files with suid set on group.

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
A. Clay Stephenson
Acclaimed Contributor

Re: finding files with set guid set

find / -type f -perm -2000 -print #finds setgids

find / -type f -perm -4000 -print #finds setuids

find / -type f -perm -6000 -print #find files with setuid AND setgid bits set

find / -type f i\( -perm -4000 -o -perm -2000 \) -print #find files with setuid OR setgid bits set

If it ain't broke, I can fix that.
Ivan Ferreira
Honored Contributor

Re: finding files with set guid set

Use:

find . -type f -perm -2000
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
A. Clay Stephenson
Acclaimed Contributor

Re: finding files with set guid set

Ooops,

find / -type f i\( -perm -4000 -o -perm -2000 \) -print #find files with setuid OR setgid bits set

should be:

find / -type f \( -perm -4000 -o -perm -2000 \) -print #find files with setuid OR setgid bits set
If it ain't broke, I can fix that.
Robert-Jan Goossens
Honored Contributor

Re: finding files with set guid set

Hi Janice,

# find / \( -perm -4000 -o -perm -2000 \) -exec ls -ld {} \; | more

Regards,
Robert-Jan
James R. Ferguson
Acclaimed Contributor

Re: finding files with set guid set

Hi Janice:

You can use:

# find /path -xdev -type f -perm -u+s

...will find files with the setuid bit whether or not the owner's execute bit is on ("s") or off ("S").

Regards!

...JRF...
James R. Ferguson
Acclaimed Contributor

Re: finding files with set guid set

Hi (again) Janice:

My apologies, There was a "g" after the word "set" and beofre the "uid". Since you want to find those files where the S_ISGID ('setgid') bit is set, do:

# find /path -xdev -type f -perm -g+s

Regards!

...JRF...
Janice Bradford
Occasional Contributor

Re: finding files with set guid set

A big THANKS to everyone for the responses.

Regards,
JB
Peter Nikitka
Honored Contributor

Re: finding files with set guid set

Hi Janice,

since you are new to ITRC forum:
please read the link about the point system
"How to earn points".

http://forums1.itrc.hp.com/service/forums/helptips.do?#28

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"