Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
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 5 '12 at 17:01

1 Answer 1

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.