ssh upload www
Ssh upload www. Note this article is for Debian based Linux distributions.
Several web designing tools offer ssh or sftp uploads to your site folder. Normally your user (if using a regular user) doesn’t have access to the /var/www folder. Unless you are using the root user, and that is not recommended. Remote root login should be blocked.
For ssh upload www we first need to change the folder permissions to 775. The reason for that is because we want to give groups access to write and modify files in the www folder. To change the folder permissions we do: sudo chmod -R 775 /var/www/
Note: the command above will also change the permissions in all sub-folders of www. If you only want to set 775 to the www without sub-folders, just remove -R. In most cases that will be enough as your software will create the folders it needs. And inherit the permissions from www.
Next we will need to add our user to the group www-data. That is the group used by the webserver. Doesn’t mater if you use Apache or Nginx, it will still use www-data. Here is how to add your user til www-data: sudo usermod -a -G www-data john
Here we are assuming the user is called John. Usermod means modify user. Then we are using two parameters. The first one -a means append (to supplementary groups and is always used together with -g).
The second one -G means groups. You can list more than one group. We only listed www-data. But you could list a whole list of groups. Use comma to separate them if you want to list more than one group.
Third parameter is the group(s) we want to add to the user.
Finally, the fourth parameter, is the name of the user we want to modify.
That is all on ssh upload www topic. Enjoy!
Happy uploading!