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?
One simple, albeit slightly dirty method for this would be to put
hostname yourhostname
into /etc/rc.local.