Skip to contentSkip to conversation

find

DISCUSSION Mikael Chambon 4 participants 4 messages Jul 27, 2003 – Jul 28, 2003

lore
Share & tools
lore
#0 lore raw

Dear linux admin,

I apolozised in advance if it's the wrong mailing list.

I use a periodic shell script to check SUID files
on my linux servers using the command:

"find / -type f -perm -4000 -print"

Does someone know if there is a way
to tell find to discard /dev and /proc directories.

I am not really a shell guru so if someone could give me a hand to solve this little problem I would really appreciate.

--
Mikael

#1 lore raw

Hi Mikael,

sure it could do better, but as a quick answer:

ls -ad /* | grep -v -e dev -e proc | while read dir; do find /$dir -type f -perm -4000 -print
done

hope this help you...

Monday, July 28, 2003, 1:41:07 AM, you wrote:

MC> Dear linux admin,

MC> I apolozised in advance if it's the wrong mailing list.

MC> I use a periodic shell script to check SUID files MC> on my linux servers using the command:

MC> "find / -type f -perm -4000 -print"

MC> Does someone know if there is a way
MC> to tell find to discard /dev and /proc directories.

MC> I am not really a shell guru so if someone could give me a hand to solve MC> this little problem I would really appreciate.

MC> --
MC> Mikael

MC> -
MC> To unsubscribe from this list: send the line "unsubscribe linux-admin" in MC> the body of a message to [email protected]
MC> More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 7 lines
Best regards,
 César                            mailto:[email protected]

-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
In reply to Mikael Chambon

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 7 lines · Mikael Chambon

I use a periodic shell script to check SUID files
on my linux servers using the command:

"find / -type f -perm -4000 -print"

Does someone know if there is a way
to tell find to discard /dev and /proc directories.

Well, first, /dev should not contain any regular files at all (except maybe for MAKEDEV which should not be suid).
For /proc I am not sure... I guess, I'd rather pass find all the paths I want it to search. This looks a little more ugly, but it should work as well:

find /bin /boot /etc /home /lib /opt /root /sbin /tmp /usr /var -type f -perm
- -4000 -print

There is probably a more elegant solution available that I am not aware of... But this one shouldn't be too dirty...

Kind regards,

Benjamin Walkenhorst

- --
Benjamin Walkenhorst
eMail: [email protected]
homepage: http://www.krylon.de

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: Public Key available at http://www.krylon.de

iD8DBQE/JNo2oYumWdMvhMQRAsmaAJ9W0lHa8H5PYl2DX9EHtEBHfTFYxwCgij99 rMqPtMVyro8cw85bzJzzMX4=
=oA/w
-----END PGP SIGNATURE-----

#3 lore raw
In reply to Mikael Chambon
Quoted 7 lines · Mikael Chambon

I use a periodic shell script to check SUID files
on my linux servers using the command:

"find / -type f -perm -4000 -print"

Does someone know if there is a way
to tell find to discard /dev and /proc directories.

find / -path /dev -prune -o -path /proc -prune -o -type f -perm -4000 -print

Signature · 1 line
Glynn Clements <[email protected]>