[Pkg-shadow-devel] Documentation question regarding allowed characters in user names

Marc Haber mh+pkg-shadow-devel at zugschlus.de
Wed Jul 6 11:22:33 BST 2022


Hi,

adduser maintainer here. I have a question about useradd which might
influence adduser's decision on which characters to allow in the user
name of a "dynamically allocated non-system user".

Useradd's manual page says:
(1)
       It is usually recommended to only use usernames that begin with a lower
       case letter or an underscore, followed by lower case letters, digits,
       underscores, or dashes. They can end with a dollar sign. In regular
       expression terms: [a-z_][a-z0-9_-]*[$]?

(2)
       On Debian, the only constraints are that usernames must neither start
       with a dash ('-') nor plus ('+') nor tilde ('~') nor contain a colon
       (':'), a comma (','), or a whitespace (space: ' ', end of line: '\n',
       tabulation: '\t', etc.). Note that using a slash ('/') may break the
       default algorithm for the definition of the user's home directory.

In adduser, for non-system accounts, we have a configurable regular
expression defaulting to ^[a-z][-a-z0-9_]*\$ which can be switched off
with a --force-badname configuration option (which we might change). If
--force-badname is given, we fall back to the IEEE 1003.1-2001 default
of ^[_.A-Za-z0-9][-\@_.A-Za-z0-9]*\$?$

Both regular expressions don't allow non-ASCII characters.

Does your documentation language in paragraph (2) mean that in Debian
arbitrary user names are allowed with the mentioned restrictions? Does
that mean punctuation characters and accented characters are allowed?
What is the encoding? ISO-8859-1? UTF-8? UTF-8 including _all_ possible
characters? It seems to be utf-8, and even emojis seem to work, but can
that be relied on?

What is Debian's stance on IEEE 1003.1-2001 which specifies
^[_.A-Za-z0-9][-\@_.A-Za-z0-9]*\$?$ ?

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Leimen, Germany    |  lose things."    Winona Ryder | Fon: *49 6224 1600402
Nordisch by Nature |  How to make an American Quilt | Fax: *49 6224 1600421



More information about the Pkg-shadow-devel mailing list