Imagine the following situation: you have to compile some Linux/Unix application or kernel module that requires kernel source present at your hard drive, say, in /usr/src/kernels/kernel-2.6.21-i386/ or elsewhere. But there is not enough disk space to copy these sources or install kernel-devel or linux-source packages (in Fedora/RedHat or Ubuntu/Debian distros respectively)… Sounds familiar? Believe me, sometimes it happens
As a solution you can mount the directory of some remote PC that contains needed kernel source. It can be done via several protocols like smb, ftp etc. In this article we will mount remote directory using ssh protocol that is one the most popular for remote and secure access to Linux boxes over the network.
Below are the steps which should be taken to get the ball rolling. We need two packages: sshfs and fuse-utils.
1. Install necessary packages:
a. Ubuntu/Debian:
sudo aptitude install fuse-utils sshfs
b. Fedora/Centos/RedHat:
yum install fuse-sshfs fuse fuse-libs
c. Other Linux: download and compile sshfs/fuse from sources
2. Check that kernel module fuse is loaded:
lsmod | grep fuse
There should be the line containing “fuse” in the output (of not try modprobe fuse).
3. Mount remote filesystem using something like this (two commands):
mkdir -p /mnt/sshfs/
sshfs remote-user@remote-machine:/some/directory /mnt/sshfs
where remote-user is the username allowed to login remote-machine via ssh protocol. It will ask you to type the password so just type it and press return
4. That’s it. Good luck!










Hello,
I used this technique last week but it doesn’t work very well in ubuntu.
If you use two differents users on ubuntu and the server and if you use gedit to edit a file in the sshfs it donsn’t work. Is not possible to update two time the same file in sshfs.
I use the server connection in Nautilus to edit files on my servers.
Sorry for my english, i am french.
This is so cool!
Hi, YanK! Which version of Ubuntu do you try? Those GUI tools you tried for mounting directories via ssh use sftp program instead of fuse/sshfs… When you use the way I described in the post you can handle mounted directory as local one — the only difference is the transfer speed
No no, I used exactly the same method as you.
I am on ubuntu 8.10. I used sshfs and it work but is not possible to edit twice the same file with gedit. It work perfectly with KWrite.
I saw others persons who had the same problem on French forums.
Finnaly i use sftp with Nautilus and it work perfectly.
I don’t know why fuse/sshfs don’t work with gedit.
I haves use then and works
That is so nice!
I will try it!
great instructions, thnx a lot!!
i really needed this stuff to get synkron working with my netbook…
Gr8 tutorial !
But i cant find how to unmount it
thnks
To unmount, you should use:
fusermount -u /mnt/sshfs
where /mnt/sshfs is your mountpoint. This is the same for any FUSE filesystem, I guess.
About the gedit problem:
1) If gedit reports a permission problem, try passing “-o id=xxx” option to sshfs. (This worked for me with:
SSHFS version 1.9
FUSE library version: 2.7.2
fusermount version: 2.7.2
using FUSE kernel interface version 7.8)
2) If gedit reports the file “has been modified since reading it” or something like that, then it reminds me of a similar situation over a SMB/CIFS mount. I’ve read bug reports on gedit for this (see https://bugs.launchpad.net/gedit/+bug/34813), but the developers seemed to disagree that it’s a bug. It seems to be related to the algorithm used to make backups: renaming files while open or something of the kind. Anyway one workaround was to downgrade gedit to version 2.12.x. (This worked over SMB/CIFS. It might be a different problem with sshfs.)