Find every account that can log in
ubuntu from a cloud image and oldadmin from the machine’s previous
configuration are the accounts to look for.
Check for accounts with no password set
See who can become root
sudo without a password prompt:
NOPASSWD line is not necessarily wrong, because some monitoring agents
require one. Each line should be scoped to specific commands and should be one
you added deliberately.
Remove accounts that are no longer needed
Lock an account before deleting it. Locking is reversible and confirms whether anything on the machine depended on the account:usermod -U unlocks the password but leaves the
expiry date, and the account still refuses logins with
Your account has expired:
-xdev keeps find on the root filesystem rather than descending
into container storage and network mounts, which on a host machine can take a
long time and compete with client I/O:
Container filesystems store raw numeric UIDs, so files created inside an
instance can appear to belong to a host account with the same UID. Files under
Docker’s storage directory are not evidence that a host account is in use.Deleting an account frees its UID, and the next account created can inherit
ownership of those files.