今天在使用 fabric 中的
Connection closed 的异常，Google 之后发现
$ sftp firstname.lastname@example.org Connecting to domain.org... email@example.com's password: subsystem request failed on channel 0 Connection closed
In your /etc/ssh/sshd_config (not ssh_config) file, you probably have a line like this:
Subsystem sftp /usr/lib/misc/sftp-server
If so, it's the cause of this error message. That's especially true if your sftp user is logging into a chrooted environment, where "/usr/lib" probably does not exist. My own sftp server is configured this way.
However, SSHD has the sftp functionality built-in and does not need to execute an external "helper" program like that. So, if you have a line like the above, it can be fixed by changing it to:
Subsystem sftp internal-sftp