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? I am by no means an expert on this, but AFAIK all scripts and apps have (or at least should have) a well-defined input semantics. IOW, no script should try to be "smart" and heuristically guess whether you provided a username or a userid in the input. It should always expect *only* *one* of these two. Now, if it expects a username, once you provide it the script will look it up in /etc/passwd to find a corresponding userid. In this case there is no problem with username being completely numeric. If the script expects a userid, once you provide it it will use it, and either ignore the username (if it is not important) or look it up in /etc/passwd (if it is important). In this case there is also no problem with the username being completely numeric. The only problematic situation may arise if the script does not have a well- defined input rules, and can expect either the username or userid, and then try to guess what you have entered, based on the contents and the context. In this case confusion can arise. But I would say that such kind of a script has a bug and should be fixed, rather than that numeric usernames should be forbidden. There is no conceptual problem with having numeric usernames, as long as each app knows exactly what input to expect, and use /etc/passwd to make a proper map from username to userid and vice versa. Any app which doesn't know exactly what input to expect is just broken, simply put. If you encounter such an app or script, file a bug against it. So I guess 12345 should be a valid username as any other, and useradd correctly allows for creation of such usernames. No bug there. P.S. A bit of heuristic thinking: numeric usernames are a very elementary thing to consider, and if they were not supposed to exist, wrong useradd behavior would have been spotted and corrected a looooong time ago. ;-) HTH, :-) Marko -- users mailing list users@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines