How to fix failed subsystem request on channel 0
Today when I was trying to scp some file I was greeted with the following error.
# scp a.txt user@somehost:/tmp/b.txt subsystem request failed on channel 0 scp: Connection closed
This cryptic error message comes from a default configuration change that OpenSSH introduced in version 9.
By default it now uses the sftp protocol to transfer files and no longer uses the original scp protocol.
Thus for hosts that do not support the SFTP subsystem, but only support basic SCP, the file transfer fails with the above error.
luckily there is -O Parameters that can be used to select the native SCP protocol, and the transfer is successful:
# scp -O a.txt user@somehost:/tmp/b.txt