OpenBSD Change Hostname

Posted on in Categories , last updated May 8, 2008

Q. How do I change my hostname under OpenBSD operating system?

A. The hostname command displays the name of the current host. The superuser (root) can set the host name by editing a /etc/myname file. This is used at system boot time by netstart to initialize the hostname.

Task: OpenBSD Display hostname

Type the any one of the following command
# hostname
# cat /etc/myname

Output:

openbsd.nixcraft.in

Task: OpenBSD Chane Host Name

Simply login as root and type the following command:
# echo "new-hostname.domain.com" > /etc/myname
# echo "server.nixcraft.in" > /etc/myname
# echo 'unixbox' > /etc/myname

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

1 comment

Leave a Comment