0

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.

Madara's Ghost
  • 607
  • 4
  • 9
  • 23

1 Answers1

0

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.

labsin
  • 575
Ads20000
  • 1,983