3

I was tired of my system's name so i decided to change it. I gksudo gedit /etc/hostname and changed my first and never touched computer name to a new one. Then now when i sudo something like sudo gedit my terminal prompts ~: unable to resolve host <my_new host_name_i_gksudo>.

When i sudo cat /etc/hosts it gives me:

sudo: unable to resolve host <not_of_your_business!>
127.0.0.1   localhost
127.0.1.1   leviathan

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

How could i get rid of this problem? Thanks in advance.

muru
  • 197,895
  • 55
  • 485
  • 740
ovrwngtvity
  • 373
  • 6
  • 14

3 Answers3

3

Have you defined your new hostname in your /etc/hosts file?

When changing your hostname, you need to alter it in both the /etc/hostname and /etc/hosts files. And once you've done that, either reboot or restart the hostname service:

sudo service hostname restart
Aaron
  • 6,714
3

Change this line in /etc/hosts:

127.0.1.1     your-old-hostname

to:

127.0.1.1     your-new-hostname
Wilf
  • 30,194
  • 17
  • 108
  • 164
0

The sudo command can take a hostname parameter. eg.

sudo -h my-new-hostname reboot

P.S. After the reboot, it should all be happy assuming you've changed your hostname correctly.