hostname

Chris Hill chris at monochrome.org
Sat Oct 30 20:24:07 UTC 2010


On Sat, 30 Oct 2010, Tim Kellers wrote:

> On 10/30/10 4:00 PM, Tim Dunphy wrote:
>> how can I set the hostname so that it persists through reboots? I have
>> set the hostname I want in /etc/hosts but rebooting the change does
>> not show up. In CentOS you have /etc/hostname which serves this
>> purpose but in FreeBSD I don't know how to do this.
>> 
>> 
>> thanks
>> 
> edit /etc/rc.conf and enter:
>
> hostname="[put your hostname here]"
>
> change the [put your hostname here] to your actual hostname.
>
> And it will load the name on (re)boot.

If you don't want to wait for reboot, you can set it immediately by typing

   hostname putyourhostnamehere

as root, substituting your desired host name for putyourhostnamehere. Also 
see `man hostname`. Note, this is *in addition to* editing rc.conf. The 
hostname command sets the hostname right now, and rc.conf makes it happen 
on each boot.

--
Chris Hill               chris at monochrome.org
**                     [ Busy Expunging <|> ]


More information about the freebsd-questions mailing list