1

I have a virtual server running Debian Squeeze. I can change the hostname by running the hostname new.host.name command or by editing /etc/hostname and then running /etc/init.d/hostname.sh, but after a reboot the hostname will be reset to the preconfigured hostname chosen by the server-hoster. I do not know which virtualization solution is used and I do not have access to an admin interface to change the hostname.

How can I change the hostname with a script each time the server boots?

x-ray
  • 130
  • 1
  • 6
  • 1
    Have you tried a simple grep of `/etc/init.d` to see if anything else is setting the hostname? Maybe just give up on setting the hostname, why do you think you need to change it? Not much really depends on it, most applications can be configured to not use the system-defined hostname. – Zoredache Oct 05 '12 at 17:01

1 Answers1

0

One simple, albeit slightly dirty method for this would be to put hostname yourhostname into /etc/rc.local.

por
  • 730
  • 6
  • 8