How to: Mount a SFTP Folder (SSH + FTP) on Ubuntu Linux using SSHFS & Fuse
Purpose: to mount a remote directory on my local Ubuntu Linux Desktop system using SFTP (which is SSH in an FTP-like fashion). The goal is to easily gain access to a remote system’s files through another folder on my desktop. Debina/Ubuntu allows you to easily mount SSH folders via the GUI, however, these mounts won’t show up in the terminal (and in some programs). I used sshfs to accomplish this.
Special Thanks: goes to user llamakc from ubuntuforums.org for helping me with this one night in this thread; also, can find Ubuntu’s SSHFS documentation here.)
install the sshfs software and mount
After some trial and error on my part, I found that only a few simple steps are needed to get everything up and running:
First, get the sshfs software (which is based on FUSE); if you have Ubuntu, this is easy because it is an included package available for easy install. After the package is installed, you need to add your username to the fuse group. On Ubuntu, you would open a terminal window and perform the following:
sudo aptitude updatesudo apititude install sshfssudo adduser yourusername fuse
After, restart your machine. (I have tried just logging in and logging out, but I kept getting permissions errors — all of which disappeared after a restart.)
The next step it so to create an empty directory that will serve as the “window” into the SFTP server. I created a folder on my desktop called sftp. Once the folder has been created, simply run sshfs using the appropriate login information (host username and IP), the host and local directories, and the SFTP connection is mounted on a folder on my desktop.
mkdir ~/Desktop/sftpsshfs HOSTuser@remote.host.or.ip:/host/dir/to/mount ~/Desktop/sftp
This folder will work like any other folder on your system; when you restart your computer (or logout and log back in) you will have to go through the last step of the process again (calling the sshfs program) to enable the folder on your desktop (save time by creating a bash alias).
possible errors and workarounds
When I restarted my system the first time (using Ubuntu 6.06), after having so cleverly got sshfs to work, and tried to run my sshfs command I got an error:
sshfs HOSTuser@remote.host.or.ip:/host/dir/to/mount ~/Desktop/sftp
fusermount: failed to open /dev/fuse: No such file or directory
A quick search on google brought me to the sourceforge FAQ for sshfs and there, lo and behold, the following was suggested to rectify the situation:
sudo mknod -m 666 /dev/fuse c 10 229
After running this command, I was able to mount my SFTP directory. I never received this error using Ubuntu 6.10.
If you get any permission denied warnings, be sure you have added your username to the fuse group and also restarted your system.
create a bash alias to save time and typing
To save time, I created a bash alias that would remember all the details for me.
First, make make sure my system reads from the ~/.bash_aliases file (it may not be default). Open ~/.bashrc and ensure the following lines are uncommented:
# Alias definitions.# You may want to put all your additions into a separate file like# ~/.bash_aliases, instead of adding them here directly.# See /usr/share/doc/bash-doc/examples in the bash-doc package.if [ -f ~/.bash_aliases ]; then. ~/.bash_aliasesfi
Next, create (or modify if you already have one) your ~/.bash_aliases file.
nano ~/.bash_aliases
I added the following single line of code to the document (first call the mknod, if you are getting the error, then the sshfs):
alias sftp='sudo mknod -m 666 /dev/fuse c 10 229; sshfs HOSTuser@remote.host.or.ip:/host/dir/to/mount ~/Desktop/sftp'
Now, when I open the terminal, I just type:
sftp
And everything loads correctly. Is very fast and very nice. I like it.
finally:
Changes to your ~/.bash_aliases file will only take effect after you have reopened the terminal or called:
. ~/.bash_aliases
If you ever want to unmount the directory without logging out or restarting, use the following:
fusermount -u ~/Desktop/sftp

Fucking love you, this works amazingly!! Saved me a lot of hassle, thank you!
[...] Remote Connetions benutzen kann. Nach ein wenig googeln, habe ich dann eine Lösung gefunden und einen passenden Artikel wie man sshfs einrichtet dazu.Man muss einfach sshfs benutzen und kann so eine SSH Verbindung einfach auf einen Ordner [...]
[...] http://blog.damontimm.com/how-to-mount-a-sftp-folder-ssh-ftp-on-ubuntu-linux-using-sshfs-fuse/ Share this post! [...]
It is usefull for Xubuntu users !!.
Thanks.
Carlos
[...] How to: Mount a SFTP Folder (SSH + FTP) on Ubuntu Linux using SSHFS & Fuse [...]
I really like your easy-to-walk-through article on sshfs. Many young GUI-*nixers could learn from you. Nice article!
Yea – I still use it … though with 08.04 you only need to run a
sudo aptitude install sshfsand no longer have to monkey around with all those other steps. Can mount the file system right after that. I use it all the time still. Not a fan of Nautilus’s method …Yes, you are correct! This post referred to an earlier version of Ubuntu — I have updated to include the note that this is for older versions and is no longer necessary. Thanks for reminding me.
You can do exactly teh same thin with the application in the menu shortcuts : ‘connect to serveur’.
Just choose SSh, type your informations and here you have on you’r desktop the remote directory.
It’s working but maybe your method is better, i’vs no ideas.
This is actually still helpful even though you can mount locations using the “connect to server” method now. Nautilus navigates the folder using “sftp://user@host” which not all programs can handle properly. Using the sshfs method allows you to mount it as a regular folder and all applications can work with it.