* How To SFTP From Mac To Windows With Fugu

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.

3 Replies to “* How To SFTP From Mac To Windows With Fugu”

  1. Has anyone tried using MacFuse to mount an SSH session as a filesystem on Mac? I’ve run into problems doing this. The connection is slow (though possibly this is somehow finder’s fault) and unreliable. There seems to be a build up of sftp-server processes on the Cygwin box.

  2. Greetings Will,

    Couple of ideas. The sshd_config file can be tricky to edit. It’s a text file with the “.txt” part. Some text editors will add the “.txt” after you’ve edited it, leaving you with two files: sshd_config (old) and sshd_config.txt (new). Delete the old, rename the new, and that may fix it.

    Another suggestion would be connecting with a local SFTP client to try to debug (i.e. from the same machine running the server). That can help narrow down the issue. It could be a port-forwarding issue, a firewall issue, or some other issue.

    Hope it helps.

    Regards,
    Erik

  3. I am having the “Request for subsystem ‘sftp’ failed on channel 0” problem. I tried adding the line to the sshd_config and restarting the SSH server, no dice.

Leave a Reply

Your email address will not be published. Required fields are marked *