≡ Menu

OpenBSD Change Hostname

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



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

Share this tutorial on:

Like this? Follow us on Twitter OR support us by using Patreon

{ 1 comment… add one }
  • Michael Kremser April 23, 2014, 4:24 pm

    To make hostname changes effective, one could issue this command:
    hostname `cat /etc/myname`

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: , , , , , , , , ,