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.
Asked
Active
Viewed 6.1k times
59

Naftuli Kay
- 39,676
1 Answers
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).

Rainer Bendig
- 4,166
user
for sure. Somehow I was imagining an option like find -chmod – Sridhar Sarnobat Apr 08 '22 at 16:37