You're trying to solve a problem with a scalpel, but what you need is a big rock. Consider:
Unix usernames are mapped to numeric User IDs.
This is a many to many mapping with no restrictions.
So nothing is stopping you from creating a bunch of accounts (
random and mapping them all to the same numeric User ID, home directory, etc. -- Simply edit your password file and add multiple users with the same numeric User (and Group) ID.
You could even do this for
root (UID 0) if you wanted -- In fact *BSD systems typically come with a
toor account with UID 0, that has its password locked out and is unable to log in.
(Most sysadmins remove this account, out of a suitable level of paranoia...)
This is a somewhat brutish solution, lacking any level of style or finesse, but simple is often best.
- When these users run
whoami, or when you look at them in
who output you'll usually see the first username that appears in the password file for a given numeric UID, but you'll see that anyway with the solutions you described above.
- If you use SSH Keys (
authorized_keys file) it will map to the home directory of the user. If all your users share one home directory they share one
You can assign the users independent home directories if this is a concern.
- Your login records may show the authentication for the username given (rather than mapping to the first user as noted in (1) above), but this is probably a Good Thing as you can see who is logging in to which accounts from where, at least by IP address.
- Your users will have independent unix passwords. This is probably what you want, but if it's not you can write some scripts to synchronize them without too much pain and suffering.