Often you need to look for a file belonging to a certain user or group. This is done with the -user and -group search operators. You often need to combine this with a search for particular permissions. To find all files that are set user ID (setuid) root, use this:
% find . -user root -perm -4000 -print
To find all files that are set group ID (setgid) staff, use this:
% find . -group staff -perm -2000 -print
Instead of using a name or group from /etc/passwd or /etc/group, you can use the UID or GID number:
% find . -user 0 -perm -4000 -print % find . -group 10 -perm -2000 -print
Often, when a user leaves a site, his account is deleted, but his files are still on the computer. Some versions of find have -nouser or -nogroup operators to find files with an unknown user or group ID.
-- BB
Copyright © 2003 O'Reilly & Associates. All rights reserved.