[FreeBSD] How to modify hostname

发布时间 2024-01-06 01:06:41作者: profesor

 

Hi Matt,

As root, type "hostname <new hostname>", and the hostname will be changed
immediately. To make this change permanent across reboots, edit the file
'/etc/rc.conf', and add the following line:

hostname="new.host.name"

The '/etc/rc.conf' file is described here:

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/configtuning-core-configuration.html

-Andy.

 

来源:https://lists.freebsd.org/pipermail/freebsd-questions/2006-April/119355.html

 

 

 

su

vim /etc/rc.conf

修改hostname

 

vim /etc/hosts

替换原有的hostname为新的hostname

 

hostname new-hostname #再执行这条命令,这样就不用reboot,也能生效了。

 

https://www.cyberciti.biz/faq/howot-freebsd-change-hostname-without-reboot/