Secure file transfer between Windows Cygwin server and Macintosh Fugu SFTP client.
I have previously discussed how to SCP with a Windows WinSCP client to a Windows Cygwin SSH server, and that article is relevant for the server side of the equation.
But what if you want to use a Macintosh, OS X 10.4 (Tiger), with Fugu as your SFTP client? That’s what this article is about. I use Macintosh, Windows, and various flavors of Unix, but sometimes when I switch from one platform to another, things don’t “just work” as I believe that they should.
In this case, I could SCP to my Windows XP server (which runs Cygwin to provide the OpenSSH package (which includes the SSH server, and, by extension, the SCP and SFTP servers)) just fine. But when I tried to connect with Fugu, I got an error that said “Request for subsystem ‘sftp’ failed on channel 0”.
The “problem” is that WinSCP is a more feature-rich file transfer program than Fugu. WinSCP has three modes to use for file transfer: (1) SFTP, (2) SFTP (allow SCP fallback), and (3) SCP. I always use the second option: SFTP with SCP fallback. What I didn’t realize was that my server was not set up to spawn the sftp-server process and was falling back to SCP. I also prefer SCP over SFTP, primarily because SFTP is clumsy about how it handles (or fails to handle) directories.
By viewing the SFTP console window in Fugu, I could see that the SSH session started just fine, the username and password were accepted, and then the session disconnected. So the SSH server was working, the SFTP server was not.
The solution is to add one line to the SSH configuration file, C:\cygwin\etc\sshd_config
, on the Windows server as follows:
Subsystem sftp /usr/sbin/sftp-server
Then you’ll need to restart the SSH server. See my earlier article for how to do that.
Now I can use Fugu on the Macintosh or WinSCP on Windows to securely transfer files with my Windows server. But I still prefer WinSCP over Fugu.