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.


For me it was client configuration fault. 127 code means that command wasnt found. I changed WinSCP config to use "/bin/sftp-server" instead of "default" by mistake. Check your client config.