Thursday, September 5, 2019

networking - unable to edit /etc/hosts file in ubuntu 14.10



I changed the hostname from default name, set during installation to something short and nice, but didn't change it in /etc/hosts file. /etc/hostname is changed after restart but sudo is not working.



I tried to search for answers on internet. Everybody is suggesting to edit

/etc/hosts file and replace:



127.0.1.1  


to:



127.0.1.1  



but I cannot change this file either by using:



sudo gedit /etc/hosts


It gives an error:



sudo:unable to resolve host 



If sudo and its graphical derivates gksu and gksudo are not working any more, the easiest solution is to use pkexec instead to open a command-line editor like nano and correct the wrong entries in the specific configuration files (like /etc/hosts or /etc/sudoers).



Note that pkexec works for terminal applications, but needs special configuration to run GUI programs. Therefore you need to use nano instead of gedit, mousepad or whatever your default editor is...


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...