SUMMARY: max username length

From: Jerome M Berkman (jerry@uclink.berkeley.edu)
Date: Thu Feb 20 2003 - 12:22:06 EST


I asked:

I'd like to create accounts with usernames longer than 8 chars.
Is this possible? If so, how do I do it?

The answers from Tim Cutts and Spider Boardman, see below,
said it is possible but not necessarily desirable.
sysconfig shows the current max is 12 characters (11 useful plus a
trailing null):

        # /sbin/sysconfig -q generic login_name_max
        generic:
        login_name_max = 12

This is changable up to 64 at boot time:

        # /sbin/sysconfig -Q generic login_name_max
        generic:
        login_name_max - type=INT op=CQ min_val=9 max_val=64

But useradd and usermod have a max of 8 characters; even though
login_name_max is 12, "useradd long_name" fails. Since
we use those heavily in our scripts, we are stuck at 8 character
login names with a maximum of 8 characters.

        - Jerry

=======================================================================
Answers:

>From tjrc@sanger.ac.uk Thu Feb 20 09:04:16 2003
Date: Mon, 3 Feb 2003 09:22:54 +0000
From: Tim Cutts <tjrc@sanger.ac.uk>
To: Jerome M Berkman <jerry@uclink.berkeley.edu>
Subject: Re: max username length

On Sun, Feb 02, 2003 at 09:20:33AM -0800, Jerome M Berkman wrote:
>
> I'd like to create accounts with usernames longer than 8 chars.
> Is this possible? If so, how do I do it?

It's possible, but not advisable. You will have problems when you need
to interoperate with other operating systems (not all of which support
such long user names - AIX doesn't like them) and you may find that a
lot of third party programs either don't work at all, or cause you other
difficulties such as parsing output, because they allow a certain amount
of space for the username. For example, normally I could tot up the
size of some files in a directory like this:

ls -l *.myi | awk '{s += $5} END {print s}'

which works fine until one of the user names is too long, and column 3
(username) becomes continuous with column 4 (group), when suddenly I
need to be adding the contents of column 4 rather than column 5. If
some users have long names and others don't, suddenly I can't do this
simple operation any more, without writing my own program to do it.

If the only reason you want long user names is so that users have a
login name that they like, I'd resist it, if I were you.

I've worked in several places where different schemes have been used,
and the one that seems to work best, in my experience, is initials plus
an optional digit if the initials aren't unique. Hence, I am tjrc here,
and was tjrc1 when I was at the University of Cambridge. The usernames
are short, easy to remember, and personal.

If your users then want a memorable e-mail address, you could always
create aliases for them. I have one here; although my login name is
tjrc, I have an e-mail alias of tim.cutts.

Tim

-- 
Dr Tim Cutts
Informatics Systems Group
Wellcome Trust Sanger Institute, Hinxton, Cambridge, CB10 1SA, UK
=======================================================================
>From Spider.Boardman@Orb.Nashua.NH.US Thu Feb 20 09:04:16 2003
Date: Mon, 03 Feb 2003 13:18:16 -0500
From: Spider.Boardman@Orb.Nashua.NH.US
To: Jerome M Berkman <jerry@uclink.berkeley.edu>
Subject: Re: max username length 
It certainly can be done.  See the attached (wherein I've answered this
one before).
  [ Part 2: "Included Message" ]
Date: Fri, 24 Jan 2003 06:24:12 -0500
From: Spider.Boardman@Orb.Nashua.NH.US
To: Padiyath Kumar <Kumar.Padiyath@psi.ch>
Subject: Re: username length 
See 'sysconfig -q generic login_name_max', and 'man 5 sys_attrs_generic'.
However, be aware that the value of that sysconfig parameter INCLUDES the
trailing NUL byte.  Thus, the default value of 12 supports 11-byte username
strings.
Hope this helps,
	--s.
-- 
Spider Boardman (at home)		      spider.boardman@Orb.Nashua.NH.US
The management (my cats) made me say this.    http://users.rcn.com/spiderb/
PGP public key fingerprint: 96 72 D2 C6 E0 92 32 89  F6 B2 C2 A0 1C AB 1F DC


This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:49:08 EDT