Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

This question already has an answer here:

I am new to the world of linux and I've installed a Xubuntu 12.04 on my desktop computer. I am learning web development (Php, html, CSS, javaScript, JQuery etc...) so I need to establish an Apache server on my machine. With synaptic package manager I already installed some packages that seem to work so when I type localhost to my browser it gives an html site that says:

"It works! This is the default web page for this server. The web server software is running but no content has been added, yet."

I have read a few things on the internet on this topic, and now I know that I should be able to write my php in documents that are stored in filesystem/var/www/ but I cannot create documents in there - apparently because I am not logged in as root. Could somebody help me with that?

Also please note that I have very little (if any at all) knowledge of linux so please make it comprehesnible for such an uninitiated user as I am.

share|improve this question

marked as duplicate by Eliah Kagan, Mitch Aug 27 '14 at 7:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

While it's possible to log in as root it is not recommended and sudo is the preferred way to run commands as root. See:How to enable root login? – Warren Hill Nov 16 '13 at 17:18
Hey guys as I said I'm an amateur, I have no knowledge about terminal commands whatsoever. what I try to accomplish is to be permitted to save files into filesystem/var/www. Can somebody help me with that? the sudo - i solution doesn't work neither does the one described here:How to enable root login? please consider that I'm a newbie. I just installed my first ubuntu relase a couple hours ago. – user216408 Nov 16 '13 at 18:25

Type sudo in front of the commands you want to execute as root. You cand easily create documents by going sudo <your main text editor> <desired filename>.

Also sudo -i of you want to keep elevated root rights until you command exit.

share|improve this answer
Thank you for your quick answer. I typed sudo -i to the terminal, then typed my password and it seemingly changed my status to root, but when i try to save a php document with gedit, it still errors with: "You do not have the permissions necessary to save the file". Can you help me with that? – user216408 Nov 16 '13 at 17:24
Did you try doing sudo gedit <filename>? You need to start the editor from the terminal in which you've gained elevated rights. – Shmukers Nov 17 '13 at 11:03

Not the answer you're looking for? Browse other questions tagged or ask your own question.