Introduction to SSHFS – the *best* way do transfer files between your PC and you when you are outside and in emergency

Sometimes when I’m in a conference of in a meeting. I need some files that is on my PC but not on my laptop to run my demo program. There’s no way I could run back home or to my lab to grab them. And the only thing I have on my PC running(running Linux) at the time is a SSH server. Sh*t, setting up a http server to transport files takes minutes even with nodejs and http-server. And sometimes I need bidirectional IO… I have a perfect solution for that.


SSHFS is a program/command that allows you to mount a remote system’s directory like a local disk. The only requirement of the remote system is that a SSH server is running on it. On Ubuntu/Debian, sshfs can be intalled via apt

sudo apt-get install sshfs

On Arch based system. You want to use pacman for this.

sudo pacman -S sshfs

Once mounted. The directory acted as a normal directory. You can do a ls on it. Read and write from it, etc… The data is transferred instantaneously. There are no caching and buffering going on. Well… due to that there are no caching. The file accessing speed is limited to your network speed. Be aware of this.

Once installed. You are good

Mounting a remote directory

Now, to mount a remote directory. Use the sshfs command. The command works like the mount command we are so used to. For example. To mount the directory ~/Documents of user marty on a box at to ~/RemoteDir. The Following command is used.

sshfs marty@ ~/RemoteDir

Just like ssh you cad add a -p parameter to specify the port your SSH server is runnint at.

There are a lot more you can do with this command described on ArchWiki. Have a look if you are interested.

Unmounting directory

To unmount a directory mounted by sshfs:

fusermount -u /path/to/your/sshfs/mount

For example:

fusermount -u ~/RemoteDir

SSHFS got stuck

If you have unstable connection. SSHFS might got stuck. Any file inside SSHFS cannot be read or written. If that happens. Unmount the directory then remount it again. Then your good to go.

Have fun developing 😀


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Powered by

Up ↑

%d bloggers like this: