SFTP – subsystem request failed on channel X

You are using sftp to connect your server in a chrooted environment and you met the error below.

subsystem request failed on channel 0
Couldn’t read packet: Connection reset by peer

This causes because of wrong external library configured in your sshd_config. So, edit your sshd_config and use internal-sftp. Because openssh already has internal sftp functionality and you dont need any external libraries.

Find the line beginning with “Subsystem”. Comment out and add the following line.

Subsystem sftp internal-sftp