We help IT Professionals succeed at work.

Help with Unix Find Command for Red Hat

netwrked
netwrked asked
on
Medium Priority
641 Views
Last Modified: 2013-12-06
Is there a way to format a Unix find command that will search all filesystems for all instances of device files, sgid and suid files?  We have a requirement to baseline our systems so we have something to compare against in case new files of these types show up later.

Thanks,

Joe
Comment
Watch Question

sysadmin
CERTIFIED EXPERT
Commented:
find / -perm /4000 -o -perm /2000
This will find suid (4000) and sgid (2000) files.
If this doesn't work, you may try replacing '/' with '+', but this is deprecated way.

All device files are located in /dev/. To get full list, you may use:
find /dev/ -print
or
simple ls /dev/ command.

I think you can use following command to have listed all files you want:
find / \( -perm /4000 -o -perm /2000 -o -type c -o -type b \)
You may also add "-ls" option to above find command (after ending "\)") to have output similar to the one you can get with ls -l file.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
Works great, many thanks for an easy solution!

Joe
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.