pure number allowed as username in the useradd command?

Tom H tomh0665 at gmail.com
Fri Dec 3 07:04:20 UTC 2010


On Thu, Dec 2, 2010 at 8:04 PM, Genes MailLists <lists at sapience.com> wrote:
> On 12/02/2010 07:42 PM, Marko Vojinovic wrote:
>> On Thursday 02 December 2010 21:02:17 Aaron Konstam wrote:
>>> On Thu, 2010-12-02 at 18:10 +0100, Joachim Backes wrote:
>>>> Can somebody explain why pure numbers are allowed for username in the
>>>> useradd command?
>>>>
>>>> sudo useradd 123456789
>>>>
>>>> is not rejected!
>>>>
>>>> As is known, this leads to big problems if referring to such a user and
>>>> the username differs from the userid: should such a username be
>>>> interpreted as username or userid?
>
>  Can you be specific - what big problems are these ? Never tried, but
> it is by means obvious that this would be problematic.
>
>> So I guess 12345 should be a valid username as any other, and useradd
>> correctly allows for creation of such usernames. No bug there.
>
>  Agreed - without knowing what the problems are it is hard to say that
> useradd (or anything else) should disallow numerical id's ..

In Solaris, there are restrictions on the username. It has to start
with a letter, cannot start with a hyphen, and cannot contain a colon.
(There may be more restrictions; these are the ones that I remember.)

I've always assumed that Linux had the same restrictions but "man 5
passwd" on my F14 box yields nothing so I've just googled and the only
restriction that
http://www.kernel.org/doc/man-pages/online/pages/man5/passwd.5.html
sets is "It should not contain capital letters".


More information about the users mailing list