0

I want to use PHPStorm or Sublime Text to change files in /var/www directory.

But in PHPStorm I can't even open files and in Sublime Text I can open, view and change files, but it always asks for my password when I save it.

How I can do this without always being asked for a password?

David Foerster
  • 36,264
  • 56
  • 94
  • 147
MIkle
  • 31

1 Answers1

0

That directory and it's files are probably not owned by your user, or it's group.

Adding your user to the group that owns the directory and/or the files will likely allow you to do that. However that's a bad solution. A good solution would be do your work on a directory within your home directory and then deploy the work to /var/www if needed.

Most modern web frameworks allow to run a development server on an unprivileged port and serving specifically only the project were you're working on. Alternatively configure your web server to serve a vhost for a directory that contains your project within your home directory.

  • Alternatively, unless the application is modifying it's files, it can be owned by user, and www-data can have read and execute permission on it. If uploads are used, www-data can have write access to the upload location and no more. From a security standpoint, this is desirable, as an attacker cannot exploit the web-server to inject code into files... – vidarlo Dec 17 '17 at 20:24
  • 2
    So which commands should I write to the terminal? – MIkle Dec 17 '17 at 20:26
  • This are some possible ideas but as the OP said could you please add the necessary procedures to make your answer more valuable. – derHugo Dec 18 '17 at 06:26