pure number allowed as username in the useradd command?

Marko Vojinovic vvmarko at gmail.com
Fri Dec 3 12:09:48 UTC 2010


On Friday 03 December 2010 06:28:27 Joachim Backes wrote:
> On 12/03/2010 02:04 AM, Genes MailLists 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?
>
> See chown: allows username and userid as new owner. So if a numerical
> userid is the same as a username (having another userid), which user is
> meant? The user with this username, or the user with this userid?

The username is assumed first, and looked up in /etc/passwd for a corresponding 
userid. If not found, and if the input is numeric, then it is assumed to be a 
userid.

HTH, :-)
Marko





More information about the users mailing list