Saturday, February 13, 2016

linux - Trouble changing hostname on a Rightscale provisioned CentOS instance

I am trying to change the hostname to host01 on an instance that was is using the RightImage_CentOS_5.4_x64_v5.6 - 11H2.a1 [rev 11] MCI.



So I set the /etc/hosts file to:




127.0.0.1 localhost localhost.localdomain  
10.76.249.192 host01


and set the /etc/sysconfig/network file:



HOSTNAME=host01


and rebooted.




After the reboot, everything looks good. The hostname is changed:



$ /bin/hostname
host01


However, a new file appeared in the system /etc/hostname with, the following content:



ip-10-76-249-192



The /etc/hosts host file looks like this:



127.0.0.1 localhost localhost.localdomain  
10.76.249.192 host01
10.76.249.192 ip-10-76-249-192.ec2.internal ip-10-76-249-192


After reboot, if I drop into an other user, the hostname will change back:




$ hostname
ip-10-76-249-192


Does anybody has any idea why this is happening and how stop this?

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...