Question

sudo: unable to resolve host [hostname]

Hi there,

I just created my first droplet today. I added an user and give it root privileges. Whenever I “sudo”, I get “unable to resolve host [myhostname]”. Although my command is executed fine, I still want to get rid of this?

Belows are my /etc/hostname and /etc/hosts

knguyen@knguyen:~$ cat /etc/hostname knguyen knguyen@knguyen:~$ cat /etc/hosts 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello,

Even I have similar issue, Here is the following if type “cat /etc/hosts” in CLI

127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters

127.0.1.1 fevertags_pi

Here fevertags_pi is the host name. When I try to edit this, it says permission denied and I’m not able to add anything

You may add your domain name to your /etc/hosts

like this

knguyen@knguyen:~$ cat /etc/hosts 127.0.0.1 knguyen