Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

A tip for editing the hostname in hostconfig UNIX
Changing your hostname /etc/hostconfig gives mixed results, sometimes it works, sometimes it doesn't, and there was no apparent explanation. Here's one basic but helpful thing to remember ... when you're monkeying around in hostconfig, you need to remove the hyphens that encompass the variable, for instance...
 HOSTCONFIG=-NEWHOSTNAME-   
will not work; the system defaults to "localhost." Using the following should allow you to use the new hostname without the localhost reoccuring:
 HOSTCONFIG=NEWHOSTNAME 
On my system, this particular scenario worked, mileage may vary.
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[5,412 views]  

A tip for editing the hostname in hostconfig | 4 comments | Create New Account
Click here to return to the 'A tip for editing the hostname in hostconfig' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A tip for editing the hostname in hostconfig
Authored by: matsur on Feb 17, '03 04:40:00PM

So thats why I kept getting localhost as my hostname...

Thanks for the tip!



[ Reply to This | # ]
A tip for editing the hostname in hostconfig
Authored by: aisikl on Feb 17, '03 07:27:34PM

this was always the case for me in 10.1 but since 10.2 my hostname just takes what i type under sharing in sysprefs --



[ Reply to This | # ]
A tip for editing the hostname in hostconfig
Authored by: shanxnz on Feb 18, '03 08:25:02PM

I've never had a problem with host name once you

sudo hostname new_hostname

go figure.



[ Reply to This | # ]
A tip for editing the hostname in hostconfig
Authored by: gonadman on Dec 28, '04 09:57:36AM

Thanks for the tip. I'd tried editing the hostconfig without any success. For some reason in 10.3 the changes I had made under "Sharing" weren't having any effect.

Using the command line "sudo hostname new_hostname" worked a treat. Thanks again!

---
@B)=



[ Reply to This | # ]