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 tried to change my hostname according to this guide for Debian based system:
I edited /etc/hostname file
run /etc/init.d/hostname start
Though there are errors. Always when I write a sudo command it tells me it can't recognize hostname. After I restarted the system, graphical environment wasn't working, startx command wasn't successful.
I used hostname NEWHOSTNAME and set a new hostname. Then I restarted, and tried accessing the internet and nothing happened.
The problem is that I fail to SSH to remote machine via hostname(while IP does)
The hostname return by command hostname is : california_desert
While the name returned by command nslookup $IP_address is: pcpp3238782
They did not match each other.
I think that's why I cannot connect to remote machine via hostname.
Checked with /etc/hosts;/etc/hostname; /etc/sysconfig/network; all set hostname t
Just a short Tutorial today. It’s surprising how many people do not know this. To change the hostname under Linux, open a terminal window. Type the following code.
sudo nano /etc/hosts
and change the text to your new hostname. Changes will take effect on Restart.
I want to change the hostname of my computer. I can do it by editing (as root) the files /etc/hostname and /etc/hosts (unless I missed some other important place). But that's ugly. Is there a straightforward way to do it? (The hostname command only modifies your home directory.)
This would be a useful addition to System Settings.
I have several Amazon EC2 servers and I'm using Chef to manage the configuration. I'd like to set the hostname so that the default bash prompt is more helpful.
Right now after launching a new server it's just set as:
root@ip-10-123-123-123
Since I'm using Ubuntu 12 on these boxes I consulted the corresponding man page for hostname.
On CentOS (5.x) I have a VPS that has hostname set to "olddomain.com", at least this is the domain I am getting when typing "hostname" command.
I want to change it to 'localhost.localdomain' because I think it is more generic and reliable.
localhost.localdomain already exists in these files: /etc/sysconfig/network AND /etc/hosts
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=localhost.localdomain
G
I've already tried changing the hostname by editing both:
/etc/hostname
/etc/hosts
However when I try to use sudo it doesn't work. I have to restart the computer to make sudo work again.