There are 2 different elements coming in to play:
- The ability to log into the server via ssh
- The permissions on the files.
The changes you have made to the SSH files all have to do with allowing access to the system, but the files will be owned by the user who SSH’d in.
You can read the files OK because the 755
permissions say “Owner can Read, Write and Execute,” anyone else can read and execute.
The hack (and less secure way) of solving the problem is to ensure the files are chmod 777
(IE anyone can read, delete and edit them).
A better way would be to put username into the www-data
group (in /etc/groups
) and give the files 775
permissions (ie owner and group can read, write and execute, everyone else can just read and execute)
I have not seen it before, but the sshd_config
commands, assuming they work—and I have no reason to believe they won’t—limits the user to their own directory, and to only executing sftp
. It can do nothing about changing the ownership of the files.