Monday, February 25, 2008

Mount SSH/SFTP drive in Windows

In Linux or Mac OS X, when you want to mount a directory in remote machine to your local machine, you just use SSHFS with command sshfs. Like this:
sshfs remoteuser@remotehost:/path/to/remote_dir local_mountpoint

This is not that easy in Windows environment. Windows is unable to speak SSH or SFTP natively. While there are many applications available to use SSH and SFTP in Windows, they don't allow mounting remote directories over SSH as a local Windows drive.

When looking around, I really found no acceptable solutions to this problem.

For starters, sshfs does not work on Windows even with Cygwin, because it needs a FUSE kernel.

Next, there are no open source (or at least freeware) applications to mount over SSH/SFTP. Granted, there are not many commercial applications either. One commercial solution - SftpDrive - seems to be an exact solution to this problem. But as it is commercial, I didn't even try the evaluation version.

There are many rumours about NetDrive (by Novell) lurking around the Internet. But NetDrive is not free (as many falsely claim) and those who have actually managed getting NetDrive to mount a drive over SFTP seem to be few in numbers. There are many sites out there that promote illegal use of NetDrive. Don't use it unless you have a proper Novell license!

In last desperation I tried to use built-in features of Windows. Windows can map an FTP location to your local computer. So, it's only natural to look for an FTP to SFTP bridge and be able to finally mount the remote directory.

Well, not that easy either. All the bridging software for Windows is also commercial. Although there are some free for personal use.

I finally tried out Tunnelier, which is free for personal and limited commercial use.

Final solution is as follows:
  • Use Tunnelier to make an FTP to SFTP bridge.
    • Go to tab "Services", enable FTP-to-SFTP.
  • From Windows Explorer Tools menu -> Map Network Drive choose option "Sign up for online storage or connect to a network server".
  • Enter FTP URL for the location you just created in Tunnelier.
  • Enter the same authentication credentials you use for SFTP.
  • Windows mounts your remote directory as a network location.

All is well that ends well? Not really, there are still a few remaining problems:
  • Windows can't actually mount an FTP location to a drive (i.e. you get no drive letter). Windows only makes available a "network location".
  • You can't mount an arbitrary remote directory. You always get the home directory (or a subdirectory below it) for the user who connected to remote server (limitation of Tunnelier).
This is still better than nothing.

Update: It appears that you can authenticate the FTP end of the bridge any way you like (anonymous or bogus username, bogus password) - you don't have to use the same credentials as for SFTP.

No comments: