How do you find files owned by a deleted user?
IntermediateConceptPermissions, Users & sudo
Answer
When a user is removed, their files remain with a numeric UID and no name (ls -l shows a number).
sudo find / -xdev \( -nouser -o -nogroup \) -ls 2>/dev/null
sudo find / -xdev -user 1005
If that UID is reused later, the new user silently owns those files, which is why we clean up or reassign before deleting.
More on Permissions, Users & sudo
Explain the rwx permission model for files and directories.BeginnerHow does octal notation work in chmod?BeginnerWhat does chown do and who can run it?IntermediateWhat is umask and how is the final permission calculated?IntermediateWhat is SUID and give a real example?IntermediateWhat does SGID do on files versus directories?Intermediate