Ubuntu: Cannot access /etc/hosts


I cannot open my /etc/hosts file. I would very much like to, I have tried logging in as root and changing the ownership and changing the permissions, please help.

When I try to open the file I get:

-bash: /etc/hosts: permission denied  


Open a terminal and run the following command...

gksudo gedit /etc/hosts  

This will open the file in gedit with root privileges allowing you to make your changes.


In the terminal type:

$  sudo su  

Type your password...

And you will get the root privileges. Then open the file via any text editor:

By GEdit

#  gedit /etc/hosts  

By mousepad ( sudo apt-get install mousepad )

#  mousepad /etc/hosts  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »