Showing results for 
Search instead for 
Did you mean: 

Hostname lenght

Jean Lefrancois_1
Occasional Visitor

Hostname lenght

What is the max lenght for the hostname on HP-UX. I remember in version 8 it was a maximun of 8 char.
Alan Riggs
Honored Contributor

Re: Hostname lenght

It remains 8. Backwards compatability with older utilities mandates this cap.
James R. Ferguson
Acclaimed Contributor

Re: Hostname lenght


Hostname and unname should be the same and therefore cannot exceed 8-characters. The length of the uname structure is defined in /usr/include/sys/utsname.h in "_SYS_NMLN" (see man 2 uname). Since this is a 9-character, null-terminated string, the maximum, safe, hostname size is eight (8).

Dan Hetzel
Honored Contributor

Re: Hostname lenght

Hi Jean,

Even if the file sys/params.h define the maximum as being 64, quite a lot of stuff has been written assuming that hostname has a maximum length of 8 characters, so you shouldn't exceed 8.

Best regards,

Everybody knows at least one thing worth sharing --
Shannon Petry
Honored Contributor

Re: Hostname lenght

Hostnames can be longer, but not recommended for compatibility with mostly MS products. ( The same reason Host1 and HOST1 are different in Unix, but both are HOST1 to windblows...Go Figure)

I have some hosts with 12 characters, and never had a problem. This is a pure Unix environment though.

If you want to stick with the 8 character, just remember you can CNAME and alias to anything you want. This is where the 64C limit would be imposed.
antidestablishmentarianism1 is a valid host alias! Of course I'd hate to have to run a few remote commands on that one! He He!

Microsoft. When do you want a virus today?