adduser per documentation uses NAME_REGEX to determine valid User IDs. The issue is contrary to the documentation NAME_REGEX does not appear to have a value (default or otherwise) as an environment variable. I reflashed RasPI Bookworm64 for a RasPI4b and confirmed this. It was originally discovered after loading Bullseye32 and Bookworm 32 & 64 using PINN for a RasPI3.
adduser.conf(5) states
The file /etc/adduser.conf sheds further insight -- the lines setting the default values were commented out so as indicated before there is not env variable and possibly default value contrary to the adduser documentation.
Yes the machine owner can fix this, but should either the documentation or the message claiming a default value is present in an env variable NAME_REGEX be changed? Apparently my assumptions so far was incorrect, adduser uses the default value indicated (I tried a leading capital letter eliciting the message) only the problem is one cannot find the documented default value in the documented NAME_REGEX environment variable as indicated in the error message when this condition is violated. Should the user possibly be told they can adjust the value by setting a NAME_REGEX value (which at this point I have not yet tested.)?
Thanks
adduser.conf(5) states
Someone should decide if this is a documentation or error message problem I used env and echo "${NAME_REGEX}" to assure the value did not exist.
NAME_REGEX
Non-system user- and groupnames are checked against this regular expression. If the name doesn't match this regexp, user and group creation in adduser(8) is refused unless --allow-bad-names is set. With --allow-bad-names set, weaker checks are performed. Defaults to the most conservative ^[a-z][-a-z0-9_]*$. See SYS_NAME_REGXEX and Valid names, below, for more information.
...
VALID NAMES
Historically, adduser(8) and addgroup(8) enforced conformity to IEEE Std 1003.1-2001, which allows only the following characters to appear in group- and usernames: letters, digits, underscores, periods, at signs (@) and dashes. The name may not start with a dash or @. The "$" sign is allowed at the end of usernames to allow typical Samba machine accounts.
The default settings for NAME_REGEX and SYS_NAME_REGEX allow usernames to contain lowercase letters and numbers, plus dash (-) and underscore (_); the name must begin with a letter (or an underscore for system users).
The least restrictive policy, available by using the --allow-all-names option, simply makes the same checks as useradd(8): cannot start with a dash, plus sign, or tilde; and cannot contain a colon, comma, slash, or whitespace.
This option can be used to create confusing or misleading names; use it with caution.
Please note that regardless of the regular expressions used to evaluate the username, it may be a maximum of 32 bytes; this may be less than 32 visual characters when using Unicode glyphs in the username.
The file /etc/adduser.conf sheds further insight -- the lines setting the default values were commented out so as indicated before there is not env variable and possibly default value contrary to the adduser documentation.
Code:
# Non-system user- and groupnames are checked against this regular# expression.# Default: NAME_REGEX="^[a-z][-a-z0-9_]*\$?$"#NAME_REGEX="^[a-z][-a-z0-9_]*\$?$"# System user- and groupnames are checked against this regular# expression.# Default: SYS_NAME_REGEX="^[a-z_][-a-z0-9_]*\$?$"#SYS_NAME_REGEX="^[a-z_][-a-z0-9_]*\$?$"
Thanks
Statistics: Posted by pasha-19 — Mon Dec 16, 2024 2:17 pm