hosts [Read-Only]: Can I change it with a full install?

Asked by Marco Parillo on 2010-10-06

I am running on a live USB (thanks to UNetbootin).

On MS-Windows, I replace my hosts file with:
http://www.mvps.org/winhelp2002/hosts.txt
I find many websites load cleaner and faster.

But on Ubuntu 10.04 LTS, when I edit /etc/hosts, gedit reports that it is read-only.
Is that because I am on a live USB, and with a full install, I would be able to replace my hosts file?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
actionparsnip
Solved:
2010-10-06
Last query:
2010-10-06
Last reply:
2010-10-06

you need to run:

gksudo gedit /etc/hosts

You edited it as a USER before, users have only read access to the file, if you run getit with gksudo it will run with elevated access and give you write access.

Marco Parillo (marco-parillo) said : #2

Thank you very much.
I clicked on Applications > Accessories > Terminal:
ubuntu@ubuntu:~$ gksudo gedit /etc/hosts

And sure enough, I could edit /etc/hosts.
So that is great.

Now you answer leads me to two more questions.

First, even after I close my terminal window, I can double click on my hosts file in my File Browser application and I can still edit /etc/hosts. Did gksudo make me root until I reboot?
I tried
ubuntu@ubuntu:~$ man gksudo
and I was re-directed to gksu, but it did not tell me how long it lasts.

Second, I have not created any users at all (I am running on a live USB). So how could I have been anybody other than root? Is Live session user not really root? I seem to have access to System > Administration > Users and Groups, and I can add users temporarily which I would not have expected from an ordinary user?

Marco Parillo (marco-parillo) said : #3

Thanks actionparsnip, that solved my question.

it has a grace period of 5 minutes or so. Your live system has a user: ubuntu with no password but you STILL need to use gksudo (or sudo) to get the extra access needed. You are only your user, root is disabled.