I want to create user accounts named after a domain name. adduser complains that the usernames need to match the NAME_REGEX
regular expression.
adduser: Please enter a username matching the regular expression configured
via the NAME_REGEX configuration variable. Use the `--force-badname'
option to relax this check or reconfigure NAME_REGEX.
I can add the users using useradd without complaint.
Is there a reason that I shouldn't modify the regular expression to allow .
, -
and _
?
What characters will cause problems and shouldn't be allowed in usernames?
This is the default NAME_REGEX
.
NAME_REGEX="^[a-z][-a-z0-9]*\$"
NAME_REGEX
already accepts-
as long as it's not the first character. – e2-e4 Sep 3 '15 at 6:02.
? Consider a user named.
or..
. Then,rm
that user named..
. – Jon May 5 '17 at 19:08rm
is not the command to use when deleting a user. I agree..
is not a sensible name for similar reasons, butrm
is not one of those. – toon81 Oct 29 '18 at 12:14