AIX, Linux, Unix, find and correct unowned files
CPatterson 1000001HQ6 Visits (11489)
Sometimes as UNIX engineers, we have to identify and correct files that have no user or group ownership. This particular command set is useful for avoiding other filesystem types like NFS, CIFS, procfs, autofs, etc.
This same general concept ports over to Linux by changing the fstype to ext3, etx2, xfs, etc. You can use the mount command to determine your filesystem types if you unsure.
To find users:
To find groups:
These commands will show you the UID and GID of the files that match the find criteria. You can then use these commands to change the ownership to an arbitrary user.
If you want to change user ownership, adjust 999 to target UID:
If you want to change group ownership, adjust 999 to target GID:
AIX/Linux Consulting PatTech LLC