Throughout my humble career in IT I generally see username length limited (typically to 8 characters). This occurs on a variety of systems including Active Directory and database apps.

Is there a reason for this? Is there best practices with regards to username creation?

  • 1
    Good question but I shudder every time I see the term "best practice". There's no such animal. Dec 17, 2010 at 21:11

2 Answers 2


It's a limitation of legacy Unix systems, and the NIS directory service in particular. Usually, this restriction is just in place if the organization is trying to keep usernames consistent across all applications (which is generally a good idea).

  • 1
    +1, lowest-common-denominator causes a lot of these restrictions. AD may support 256 char usernames, but that Solaris 7 server in the core forces the max to 8 characters. Also, the same restrictions apply to password length.
    – sysadmin1138
    Dec 17, 2010 at 18:56
  • Oh, hey, the blog guy I read from time to time. Sup? :) Dec 18, 2010 at 1:19
  • 1
    And on MSWindows systems - inherited from MSDOS limit of 8 chars in a filename
    – symcbean
    Dec 20, 2010 at 9:05
  • No, that was gotten rid of - with Windows 95. Even Fat got an upgrade including compatibility mode ;)
    – TomTom
    May 8, 2012 at 11:00

The main one I’ve seen problems with recently has been ps on Solaris (10), it lops the 9th+ characters off, so for example if you needed to grep for the username it wouldn’t match.

$ sudo -u longusername ps -fu longusername
     UID   PID  PPID   C    STIME TTY         TIME CMD
longuser 14012 11985   0 09:58:39 pts/2       0:00 ps -fu longusername

If you do an ls -l on a directory with files belonging to that user, the columns get pushed out of alignment.

$ ls -ld /export/home/l*
drwxr-xr-x   2 lauser   users        6 Mar 23 10:21 /export/home/lzuser
drwxr-xr-x   2 longusername users        6 May  4 10:02 /export/home/longusername
drwxr-xr-x   2 lzuser   users        6 Mar 12 11:21 /export/home/lzuser

Basically you would need to be wary of any tool that dealt with login names and not just UIDs. That could include things that read from or wrote to log files or databases, or used the output of tools like last, who, finger, ls, ps etc.

A quick Google turned up this page:


Which adds some more reasons.

With regards best practices for username creation, there can also be complications from using logins in capitals instead of lower case, so that should be avoided too.

When some (older) systems, when see a login in only capitals, they helpfully default to assuming that the user's terminal doesn't support lower case, so set EVERYTHING to be in capitals (which can prevent entering the password and being able to type Unix commands once you login!)

Edit (16/04/2019):

I've just noticed on RHEL 7.5, that the output of ps doesn't play nicely either:

$ ps -fulongusername
longuse+  1230 27243  0 Apr13 pts/0    00:00:00 vim somescript.sh
longuse+  1701 27243  0 Apr05 pts/0    00:00:00 vim another-script.sh
longuse+  3116 27243  0 Apr12 pts/0    00:00:01 vim test_script.sh

It truncates the username with a '+', which isn't helpful if you're not familiar with which user it will be and means you can't rely on the output of ps e.g. as input to a script that needs to know who owns a process.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .