Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

This question already has an answer here:

I have the latest version of Ubuntu installed on my computer. I would like to set it up so that I can comfortably program in PHP, JavaScript, HTML and CSS.

So I've installed Nginx and set it up, MySQL and set it up, I have an editor in place (Haven't decided between Sublime Text 2 or PhpStorm 6, but that's outside the question at the moment), and it kinda works.

My main problem is that I need to sudo anything in order to be able to edit or even access any of the configuration files, or even the public www files. That's annoying as hell. I don't want to keep Terminal windows open for every program I need in order to develop. I know that there's gksu but again, it's annoying to have to identify for everything again and again.

Also, I can't install sublime-text plugins because of permission denied errors. Again, I don't want to sudo every time I use sublime!

It's worth mentioning I'm developing in GUI, including running programs and whatnot.

Thanks in advance.

share|improve this question

marked as duplicate by bodhi.zazen, Radu Rădeanu, RolandiXor May 31 '13 at 16:34

This question was marked as an exact duplicate of an existing question.

To be able to change any file from the file manager, use:

sudo nautilus

To run it in the background use:

sudo nautilus &

To change the files so you always have access to them, right-click on each folder and click Properties then the Permissions tab and then change the permissions in the dropdown to your username instead of root. Make sure you can read and write to the directory. This isn't safe for most configuration files.

To be able to change only the thing you're working on, you should always launch a terminal for that user that can change just the things you need. That's what makes Linux safe. Esspecialy for a server (wwww). Then launch the GUI's from that user. (Like nautilus or the text editor). To be able to change the files in the www folder use:

sudo su - www-data -s /bin/bash (opens a new bash shell inside the shell with the www-data user)

From here you can do things like:

gedit &(this launches the gedit text editor in the background with which you can edit all file in the www folder. You can use any other editor. After this you can close the terminal if you don't want the debug info.)

If you made new files in the www folder with root, these files will have root as user and group, you should change these to www-data.

www-data could also be www or some other user.

The best way is still to copy, edit with normal user, backup and copy back with privillaged user and change permissions. But I can see why you'd not want to do that every time.

share|improve this answer
When I try that, for some reason Nautilus crashes. It tells me the specified owner (Madara Uchiha) doesn't exist, then crashes and ask me to send an error report. What's wrong there? – Madara Uchiha May 31 '13 at 9:34
@MadaraUchiha No that shouldn't happen. – labsin May 31 '13 at 10:53
I installed Ubuntu to ease up my development process, I wanted a faster system, where I can quickly develop and test instantly, without the distractions that come with Windows. But so far, Windows is much better at this. Everything just works, and little-to-no setup is required. Here, even after the extensive setup, the environment is still not "perfect", I still have all these quirks. Is it possible for me to simply open sublime text, edit files, and see the result in the browser? Without any fancy process I need to do each time? – Madara Uchiha May 31 '13 at 11:36
@MadaraUchiha: Yes, then you have to change the user of your http-server to your user and then do sudo chown -R name:name www-folder. That way, you can write php scripts that can change your files and you can change them yourself. The reason for this all is that the windows packages you speak of are FAR from the security you get with linux. The default in Linux is Secure. If you want to go to insecure, you'd have to come up with it yourself. These packages do just work. You get a good dedicated secure server with a couple of commands. – labsin May 31 '13 at 13:23

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