46

I'm trying to find files which are owned and have the primary group of root. Is there a parameter available to search for files like this? It's critical that all files in a certain directory not be owned by root, so I'd like to check periodically to make sure that someone on the server isn't accidentally creating files owned by root (namely me). Sure, chown -R user:user /path works, but I'd like to be able to check.

69

man find:

  -group gname
         File belongs to group gname (numeric group ID allowed).
  -user uname
         File is owned by user uname (numeric user ID allowed).
1
  • 1
    So obvious... Anyone else looked into the man page and searched for '-owner' instead of '-user'?
    – robsch
    Oct 16 '20 at 6:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.