1

This question already has an answer here:

I have a lamp project and I can't move my project in the file I'm supposed to move unless I do it from terminal as root, and then it doesn't let me open the project and change it, I have a lots of files I have to change and it's very time consuming to open them all from terminal each time I want to change them. How can I run my computer as root without the terminal?( I am new to ubuntu )

marked as duplicate by muru, Eric Carvalho, Community May 23 '16 at 18:04

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.

  • @muru Does opening nautilus as root let us to edit files (in gedit for example) as root as well? – Mostafa Ahangarha May 23 '16 at 12:48
  • @MostafaAhangarha it should, the process is running as root, anything it opens should also be running as root. – muru May 23 '16 at 12:49
0

Do not run as root

While you could simply activate the password for the root user (with passwd), do not do that. It's a very bad practice from a security point of view. Instead, you should handle permissions properly.

Run a file manager as root

You can start Nautilus with sudo privileges in the usual way:

sudo nautilus

Then you can copy the files that you need to move (I assume under /var/www). You can also open a file in a text editor, but keep in mind that the editor is going to run with elevated privileges as well. Do not run untrusted programs in this setting.

When you are done moving the files, you'll probably want to recursively fix the owner to www-data and its group:

sudo chown -R www-data:www-data /var/www/*

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