Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've installed Ubuntu Server in to a VirtualBox virtual machine. I've been able to get the GNOME desktop environment setup on it (The default Ubuntu version). This is an educational LAMP server, so I'm not concerned about the performance cost.

I'm trying to do some very minor reconfiguration of Apatche2 but in order to do this, I need write access to the files at /etc/apache2/sites-available (I think).

I'm still very new to Linux but I'm getting there. I understand that I need to change the file permissions to alter these files. (At least, according to my book). But I have to ask if there is a way to temporarily give myself super user access for a temporary time frame. Similar to sudo -i.

I'd prefer to do these changes from within the desktop environment...

If there is not a way to temporarily enable super user access (or root access), how can I change the file permissions so that I may alter the Apache configuration? My attempts at chmod is failing...

share|improve this question
up vote 1 down vote accepted

You can run a root file browser with gksudo nautilus.

This will allow you to either open the file as root (recommended) or change the permissions under the properties menu.

share|improve this answer
I didn't test it but this is closest to what I was looking for. Thank you. – Frank V Jul 30 '09 at 19:59
It's generally a bad thing to run any graphically application (especially file browsers) with root privileges. – Manuel Faux Jul 30 '09 at 20:03
What's so bad about it? – DLH Jul 30 '09 at 20:05

The answer was staring me in the face. In terminal, navigate to the location of the file and then run the following:

gksudo gedit FileToEdit

This will start the editor with admin privileges for that file only. This is probably one of the safer ways to accomplish what I need...


share|improve this answer
+1 since it's much better than starting whole nautilus as root. – Manuel Faux Jul 30 '09 at 20:04
This will work fine, but I would recommend using gksudo. It's just safer. See – DLH Jul 30 '09 at 20:12

As you have already recognized is the sudo command used to execute commands with the rights of other users. The default user which sudo uses if you don't specify another one is the root user.

Just use sudo vim /etc/apache2/sites-available to modify the file as root.

share|improve this answer
Good point - I didn't think of that - but this isn't a preferred solution... – Frank V Jul 30 '09 at 19:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .