• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: gethostname returns loginname on "Pather Server" version
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gethostname returns loginname on "Pather Server" version


  • Subject: Re: gethostname returns loginname on "Pather Server" version
  • From: Robert MacGregor <email@hidden>
  • Date: Sat, 7 Feb 2004 09:23:14 -0500

Allan,

This is very useful information. I've noticed if I use 'Turn AirPort Off' my machine will set it's hostname to it's Rendezvous name.

Does the BSD hostname algorithm run every time the network location is set?

Rob MacGregor

On Feb 6, 2004, at 9:11 PM, Allan Nathanson wrote:

Why can't I name my computer "admin"? Should all currently defined login names be excluded as possible host names?

And as to any conventions used for setting the BSD hostname (gethostname(3), sethostname(3))... You are correct that the standards are ambiguous. Suggesting that the name have some relevance to a hosts DNS name, while a nice idea, makes a number of assumptions including:

- the system is actually connected to a network
- the system has only one network interface
- the system has only one IP address
- only one name is associated with the one IP address

Unfortunately, you can't make any of these assumptions. The world of computers is no longer as simple as the days when all computers were large, bolted to the floor, and non-functional unless the network was accessible.

What are we (Apple) doing? Here's the algorithm that we use to set the BSD hostname:

1. if available, use the name specified in the /etc/hostconfig file (HOSTNAME=my-host-name)
... and this name need not have any association with a DNS name

2. if available, use the name provided by the DHCP/BOOTP server for the "primary" IP address
... and this name need not have any association with a DNS name

3. if available, use the [first] name returned by a reverse DNS (address-->name) query for the "primary" IP address

4. if available, use the rendezvous hostname

5. use "localhost"

In short, we "try" to set the BSD hostname to something reasonable but there are no guarantees.

- Allan

p.s. I believe that Mac OS X Server systems tend to set a fixed name in the /etc/hostconfig file.
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: gethostname returns loginname on "Pather Server" version
      • From: Allan Nathanson <email@hidden>
References: 
 >Re: gethostname returns loginname on "Pather Server" version (From: Jason Linhart <email@hidden>)
 >Re: gethostname returns loginname on "Pather Server" version (From: Allan Nathanson <email@hidden>)

  • Prev by Date: RE: gethostname returns loginname on "Pather Server" version
  • Next by Date: Re: gethostname returns loginname on "Pather Server" version
  • Previous by thread: Re: gethostname returns loginname on "Pather Server" version
  • Next by thread: Re: gethostname returns loginname on "Pather Server" version
  • Index(es):
    • Date
    • Thread