[NBLUG/talk] Hostname, username lengths

Eric Eisenhart eric at nblug.org
Wed May 14 18:48:00 PDT 2003


On Wed, May 14, 2003 at 05:56:30PM -0700, Andrew wrote:
> Anybody know what the maximum length is for a Linux hostname? I
> know that some Un*xen barf (or at least some of their tools barf)
> if it's over 8 characters, but I've heard tell that Linux can
> handle longer names. True?
> 
> What about usernames?

"man utmp" or "man wtmp".  Or "less /usr/include/bits/utmp.h".

In there you find that usernames are 32 byte strings, so assume 31 chars is
the max.  However, many utils will truncate to 8 characters on output.  I'd
only recommend over 8 chars on large installs, where it's worth the effort
of using "ls -n" instead of "ls -l".

hostnames are 255 (256) in there, but that would be 255 for the entire
FQDN...  (in other words, to be sure you have to count the entire domain and
any dots)  there may be someplace else that limits the hostname length.

For hostnames, I reccomend:
2 syllables or less.  3 can be okay, but is pushing it.
10 characters or less.

Not because of built-in limitations, but because on anything longer, you'll
end up abbreviating it somehow to fit into what I just said.

(the hostname is used in DNS, the kernel, libc, and individual programs.
Usually the username is only at the libc and program level; the kernel deals
only with uids.)
-- 
Eric Eisenhart
NBLUG Co-Founder & Vice-President Pro Tempore
The North Bay Linux Users Group
http://nblug.org/
eric at nblug.org, IRC: Freiheit at freenode, AIM: falschfreiheit, ICQ: 48217244



More information about the talk mailing list