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.
When I try to edit my /etc/hostname file, using: sudo nano /etc/hostname (or any other editor) I get the following: Error writing /etc/hostname: Permission denied
I then tried to: sudo chmod u+w ./hostname
and got the error:
chmod: changing permissions of `./hostname': Operation not permitted
I get the same error trying to add write permissions to any use or group.
This is what ls show:
-rw-r--r
I used hostname NEWHOSTNAME and set a new hostname. Then I restarted, and tried accessing the internet and nothing happened.
Hi Everyone,
Real newbie mistake: I changed /etc/hostname, because I didn't like the default name. Didn't know that I needed to change /etc/hosts as well so now every time I try to use sudo I get the this message: "sudo: unable to resolve host [name]" so I can't fix it.
Wondering what my options are.
Thanks,
Joel
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.
SSH and sudo were starting very slowly because /etc/hostname and /etc/hosts did not match. After adding a line for the hostname in the hosts file, the initial 2-4 second delay no longer occurs.
At first I was surpised the mis-configured hosts file caused delays with SSH and sudo. I was SSH'ing to the server with a direct IP address, and sudo did not seem to require a hostname lookup.
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.
Before the switch to systemd, I was able to ssh between my two machines via user@hostname but now I get a "could not resolve hostname" error and have to use the IP address instead.
I'm making some large-scale system hostname changes and this got me thinking...