Comment by rmunn

7 hours ago

I could agree with giving sysadmins a way to specify a list of disallowed usernames (which would be useful for more reasons than to retire certain usernames, e.g. many sites would probably disallow "admin" as a username, and depending on maturity of the userbase might also find it valuable to forbid profanity as usernames). But it should be in a text file somewhere in /etc, not hardcoded into the source of useradd.c: different sites would have different requirements, and David M. Robertson (a fictional person I just made up, and if that happens to be your actual name then congratulations), who works at a small startup whose standard practice is three-initial usernames, should not be forbidden from using the username dmr just because someone famous also had those initials.

I've tried to look up whether there's a reserved username list option for these tools but either there isn't one or I suck. One option is to set / reset the NAME_REGEX configuration (or env var?), individual distributions could do this.

  • Silly idea: just create those users manually without giving them a home directory? The names won't be available anymore. You could write a short script wrapping useradd (and userdel? I honestly haven't deleted a user in years and can't remember if that's the correct command) and define your own config file to contain the current set of names managed by the tool.