Can connect via SSH - but not via SFTP? Exit status 127
It most probably means that the /usr/lib/openssh/sftp-server
does not exist.
Make sure the Subsystem
directive points to an existing path:
Subsystem sftp /usr/lib/openssh/sftp-server
Or actually, nowadays you typically use the internal-sftp
instead:
Subsystem sftp internal-sftp
See OpenSSH: Difference between internal-sftp and sftp-server.