Sublime Text 3 authentication question when saving document

You don't have permission to write to /var/www/Rest_Of_Path_Here. ST3 is trying to elevate its UID to write as the correct user (hence the sudo prompt). I didn't know it could do this but I've tested it and it works so there you go.

There are a few ways you can fix this:

  1. Allow your user to write the files directly. So many options here:

    • chown the files so you own them. This may upset things running as other users that might also need to write, eg a webserver running as www-user. You may need to change what they run as too.
    • Add your user to the www-data group and change the file mask to 774 so members of the group can write/execute.
    • Change the file mask so other users can write (eg 777)... But this is pretty risky if there's something malicious on the server already.
    • Use ACLs to allow your user to write without disturbing the standard permissions framework.
  2. Change your workflow to write into a version control system (eg git) as your users, and then have a script running as the other user check it out. This carries other benefits.

  3. Run ST3 as a user who can write there:

    sudo -u www-data subl /var/www/Rest_Of_Path_Here
    

    This is quite a lot uglier than just fixing the files.


I had the same issue and was able to solve it by providing user right to the particular folder which I had to edit in Sublime text 3. I used the following commands:

sudo chmod 775 -R projectname/   
sudo chown username -R projectname/

I think it might be helpful to others in future.

Tags:

Permissions