59

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.

Naftuli Kay
  • 39,676

1 Answers1

83

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).