How to fix subsystem request failed on channel 0
Today I got greeted by the following error when I was trying to scp some file.
# 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 config change that OpenSSH introduced in version 9.
By default it now uses the sftp protocol for transfering files and no longer the original scp protocol.
Thus for hosts which do not support the sftp subsystem, but only the original scp, the file transfer fails with the above error.
Luckily there is the -O parameter which can be used to select the original scp protocol, and the transfer then succeeds:
# scp -O a.txt user@somehost:/tmp/b.txt