You are here

SSHFS File Transfer User Guide

SSHFS (SSH File System) is a file system client used to mount and interact with directories and files located on a remote server or workstation. The client interacts with the remote file system via the SSH File Transfer Protocol (SFTP), a network protocol providing file access, file transfer, and file management functionality over any reliable data stream that was designed as an extension of the Secure Shell protocol (SSH) version 2.0. Further details at http://en.wikipedia.org/wiki/SSHFS

SSHFS provides the ability to mount WestGrid network drives or directories to the local desktop that supports the use of local file management tools to manage data between the local file system and any WestGrid file system. SSHFS is a mechanism that will support local editing of files without the need to download files to the local system. Simply open and edit your data using your local applications. SSHFS functions well for transferring small (>5GB data files) between the local file system and WestGrid file systems. Simultaneous transfer of many large files is inconsistent and performance is not as good as other tools like Globus Online.

Installation Instructions for Supported Operating Systems

MAC OS
Windows
Linux

Macports and SSHFS on MAC OS 10.6.8

Note (2015-04-03): Since this guide was written, graphical installers for OSXFUSE (a successor to MacFUSE) and SSHFS have become available from the FUSE for OS X site for Mac OS X 10.5 and later.  You might like to use those instead of the more involved MacPorts procedure described below.

This guide is designed for MAC OS 10.6.8. Earlier or more current MAC OS versions may require different version of Macports and XCode in order for the installation to work.

Step 1

Note that in order to install and run MacPorts on Mac OS X, your system must have installations of XCode and Apple's Command Line Developer Tools. For detailed instructions on how to install these prerequisite tools and MACPORTS, please visit MacPorts official website.

Step 2

Download and install MacPorts. You should download the version that is compatible with your OS. Visit MacPorts official website and follow instruction in the section “Mac OS X Package (.pkg) Installer”

(2015-04-03: A step seems to be missing in the instructions here: sudo port install sshfs).

Step 3

Once the installation is complete, you are ready to start using SSHFS to mount a remote file system.

% sshfs user@host:/path/to/remote /tmp/remotefs

Example Mount:

Local-iMac:~ sam$ mkdir RemoteHome
Local-iMac:~ sam$ sshfs sam@silo.westgrid.ca:/home/sam RemoteHome
sam@silo.westgrid.ca's password:

Now that the WestGrid file system has been successfully mounted to the local desktop, the terminal command line can be used to copy files between the local file system and the WestGrid remote file system

Local-iMac:~ sam$ cp /Users/sam/file1 /RemoteHome/file1

Step 4

File transfers between the local file system and the WestGrid remote file system can also be performed using MAC OS X file management tools.

Open Finder to locate the mounted drive. Notice "RemoteHome" displays as a shortcut link to a network mounted drive. You can now copy data between the two file systems with ease.

SSHFS_01

DOKAN and SSHFS on Windows 7

Note (2016-02-20): The instructions below regarding the Dokan library and the download links for Dokan SSHFS are obsolete.  There are up-to-date instructions for building the software at https://github.com/dokan-dev/dokan-sshfs, but , this is quite technical and requires experience with Microsoft Visual Studio.

Dokan is a support library for SSHFS that is required for installation. It serves as middleware that obviates the need to write a specific device driver. For more information on Dokan, visit http://dokan-dev.net/en/about/

This guide is designed for Windows 7. Other supported (not tested by WestGrid) version includes: Windows XP, 2003, Vista, 2008, 7 x86 and Windows 2003, Vista, 7, 2008R2 x64.n

Step 1

Download and install DOKAN Library. You should download the version that is compatible with your OS.

Step 2

Unzip the DOKAN SSHFS files to your local directory. Step 3 Run DokanSSHFS.exe file that was located in the ZIP package downloaded in Step 2.

Step 3

Run DokanSSHFS.exe file that was located in the ZIP package downloaded in Step 2.

Step 3

Step 4

Setup an SSHFS connection to bugaboo.westgrid.ca. This tool can be used to setup an SSHFS connection to any WestGrid host. Performing this task will display a network drive (N:) available in windows explorer file manager.

SSHFS Setting

Step 5

Installation should now be complete. Files can be transferred between the local file system or any network drive using the standard file management features of the windows explorer tool.

SSHFS Windows Explorer tool

FUSE and SSHFS on Linux

This guide does not exhaust installation instructions for all distributions of the Linux operating system. You are encouraged to seek out current documentation for your specific distribution. For example, in Ubuntu Linux, simply perform an apt-get install sshfs for the SSHFS package; in Red Hat, perform a yum install sshfs.

If these packages are not available for your distribution of Linux, you can install from source. This guide will focus on how to install FUSE and SSHFS from source.

Features include:

  • Simple library API
  • Simple installation (no need to patch or recompile the kernel)
  • Secure implementation
  • Userspace - kernel interface is very efficient
  • Usable by non privileged users
  • Runs on Linux kernels 2.4.X and 2.6.X
  • Has proven very stable over time

Step 1

Installation: sshfs-fuse

  1. Download the latest stable FUSE tarball from SourceForge.net
  2. Unpack the archive:
    tar -zxvf fuse-2.X.X.tar.gz
  3. Configure FUSE for compilation:
    ./configure –disable-kernel-module --prefix=/usr/local
  4. Compile FUSE:
    make
  5. If the compilation completes successfully, enter
    make install
    to complete the installation of FUSE

Example:

Local-linux:~/Downloads$ wget http://downloads.sourceforge.net/project/fuse/fuse-2.X/2.9.2/fuse-2.9.2.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Ffuse%2Ffiles%2Ffuse-2.X%2F&ts=1363119109&use_mirror=iweb
Local-linux:~/Downloads$ tar –zxvf fuse-2.9.2
Local-linux:~/Downloads$ cd fuse-2.9.2
Local-linux:~/Downloads$ ./configure –disable-kernel-module –prefix=/usr
Local-linux:~/Downloads$ make
Local-linux:~/Downloads$ make install

Step 2

Mount a FUSE Filesystem

Enter sshfs username@server:/directory /mountpoint to use FUSE to mount a directory on a remote server.

Note, that it's recommended to run it as user, not as root. For this to work the mountpoint must be owned by the user. If the username is different on the host you are connecting to, then use the "username@host:" form. If you need to enter a password sshfs will ask for it (actually it just runs ssh which ask for the password if needed). You can also specify a directory after the ":". The default is the /home directory.

Example:

sam@linux:~$ mkdir mountbugaboo 

sam@linux:~$ sshfs sam@bugaboo.westgrid.ca:/home/sam /mountbugaboo
sam@linux:~$ cp localfile1 /mountbugaboo/*

Installation should now be complete. Files can be transferred between the local file system or any network file system using the standard file management features of the linux operating system including GUI file management tools.

 

Updates: 2015-04-03 - Added missing step to MacPorts-based installation and referenced graphical installer for OSXFUSE and SSHFS. 2016-02-20 - Provided a link to new Dokan SSHFS installation instructions.