For security reasons I would like to disable root access via ssh.
I created a new user (user1) with administrative permissions.
adduser user1 usermod -aG sudo user1
and assigned the /www directory to this user.
sudo chown -R $USER:$USER /var/www/ sudo chmod -R 755 /var/www
(My folders structure is www/site1.com, www/site2.com, etc.)
My sites need to write some files (such as sitemaps, rss feeds, etc.) so I set the permissions of the www directory to:
sudo chown -R www-data:www-data /var/www sudo chmod -R 755 /var/www
Now, however, user user1 works perfectly via shell with the sudo command, but can no longer add/edit/delete files and folders in the /www directory and its subdirectories via sftp.
I read many guides, how to set up apache permissions to increase security, to share administration with other users, etc. etc. etc.
But I still did not understand how to solve my problem.
Currently to be able to handle files on my server via sftp I have to use the root user, with peace of mind for security.
Did I miss something about setting user or folders permissions?