One may wonder what is sshfs and why would you want it? Well simply put, sshfs allows you to mount another server’s filesystem into a folder on your local system which in the background is doing ssh commands and transfers. As a mounted folder, you are able to move about and copy files back and forth as everything was on local server. As you can see this makes it very easy for you to work with files on multiple servers.
Note:Â you only have to do the following installations on the server where you are doing the mounts on.
Let us download and install the filesystem framework which is a requirement for sshfs called fuse.
wget http://voxel.dl.sourceforge.net/sourceforge/fuse/fuse-2.7.4.tar.gz
tar zxpfv fuse-*.gz
cd fuse*
./configure
If you get the following error, you will either have to point to the location of the kernel source or install it if needed.
checking kernel source directory... Not found
configure: error:
*** Please specify the location of the kernel source with
*** the '--with-kernel=SRCDIR' option
configure: error: ./configure failed for kernel
In our case here, we will be installing the source using yum.
yum -y install kernel-devel
Once installed, you will have to find out the directory it is installed in
ls -l /usr/src/kernels/
total 4.0K
drwxr-xr-x 18 root root 4.0K Oct 7 14:50 2.6.18-92.1.13.el5-x86_64/
./configure --with-kernel=/usr/src/kernels/2.6.18-92.1.13.el5-x86_64
make && make install
cd ..
Now let us get sshfs source and install it.
wget http://voxel.dl.sourceforge.net/sourceforge/fuse/sshfs-fuse-2.1.tar.gz
tar zxpfv sshfs*
cd sshfs-fuse-*
./configure
If you get the following error:
checking for SSHFS... configure: error: The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
OR
checking for SSHFS... configure: error: Package requirements (fuse >= 2.2 glib-2.0 gthread-2.0) were not met:
No package ‘glib-2.0’ found
No package ‘gthread-2.0’ found
You need to install glib2. Do the following:
yum install glib2-devel
Once installation is done, continue with configure.
./configure
make && make install
After installation is done, we can move on with testing the installation:
cd /mnt
mkdir test
sshfs 10.0.0.2:/ test
If you get the following error,
sshfs: error while loading shared libraries: libfuse.so.2: cannot open shared object file: No such file or directory
execute this: NOTE: this is for x64 system. If you have 32 bit system, you have to symlink to /lib instead.
ln -s /usr/local/lib/libfuse.so.2 /lib64/
Let us try mounting again:
sshfs 10.0.0.2:/ test
At this point it would be like if you were making a ssh connection to 10.0.0.2 You will have to type in a password to get the mount to happen. You may get the following error: fuse: device not found, try 'modprobe fuse' first
If you do ‘modprobe fuse’, as they tell you to, and you get:
modprobe fuse
FATAL: Module fuse not found.
That means your running kernel is not the same version as the one you compiled with. You have two options here:
1) you can upgrade your kernel by typing: yum update kernel
2) find the source files for the kernel you have running and recompile fuse.
I went with option 1. Once you do the update, reboot and try doing modprobe fuse again.
At this point we can try doing the mount again.
cd /mnt
sshfs 10.0.0.2:/ test
If you do not get any errors, do df -h to see the mount:
...
sshfs#10.0.0.2:/ 1000G 0 1000G 0% /mnt/test
...
At this point you can browse 10.0.0.2 server filesystem as it was local on your server.
————————————-
DISCLAIMER: Please be smart and use code found on internet carefully. Make backups often. And yeah.. last but not least.. I am not responsible for any damage caused by this posting. Use at your own risk.
Very similar procedure in Debian/Ubuntu… 🙂
apt-get install sshfs
cd /mnt
sshfs 10.0.0.2:/ test
Thank you so much! This solved a very frustrating problem for me. Kudos!
Thanks! Great manual! Helped me alot! Made it possible for me to install fuse on CentOS 5.
Very nice… saved a lotta time, I guess.
Very similar procedure in Debian/Ubuntu… 🙂
apt-get install sshfs
cd /mnt
sshfs 10.0.0.2:/ test
[2]
Thank you for this howto, this is perfect for RHEL 5.3 64 bits
It has been pain to find out, but this is the one procedure that works! Downloading the RPMs for fuse and fuse-ssh and installing them do not work (you get the “modprobe fuse” issue which I couldn’t get around)
Getting the latest sources for fuse and fuse-ssh (using sourceforge in my case), as well as creating a couple of symbolic links (especially for the library), and it worked like a charm!
Again, thank you, even though it would have been better for the RPMs to work out of the box from an update point of view.
NOTE: installing the packages via YUM works with Fedora, I am guessing it is dependant on the fact that fuse has been integrated to later kernels than the one used by RHEL.
Thaaaaaaaaaaaank you. I’m so impressed with every step. Normally howto’s leave you stuck in the middle.
Many thanks! Great article!
great artcile – many thanks – a real help -especially the stuff on what to do when you get errors!
if you have an smp kernel do not forget to download kernel-smp-devel *not* kernel-devel
Many thanks!
Many thanks your help have been very helpfull.
Pingback: Mount remote filesystem via ssh protocol using sshfs and fuse « Tournas Dimitrios
I could not resist commenting. Exceptionally well written!
Here is my blog … metal casting
Yes! Finally someone writes about بناهده.
Take a look at my web site :: 網路行銷; margueriteeji.beeplog.com,
This is a greatest page that i ever see. You must also see my page, with great oportunity! click on link!
Me quedo con esto:
Todos tenemos orígenes comunes: las madres; todos venimos de la misma sima, pero cada uno
tiende a su propio fin- Hermann Hesse 🙂 ¡Un saludo!
I am glad for commenting to make you be aware of of the wonderful experience my wife’s daughter had checking your webblog. She mastered plenty of details, including how it is like to have a very effective teaching nature to have many people without difficulty grasp several hard to do matters. You actually exceeded people’s desires. Thanks for rendering the priceless, dependable, educational not to mention cool tips on your topic to Janet.
A lot of thanks for all of your efforts on this website. Kim loves getting into investigation and it’s easy to understand why. A lot of people hear all concerning the powerful form you give useful guides on the blog and in addition strongly encourage response from other ones about this area of interest plus my child is now understanding a whole lot. Take advantage of the remaining portion of the new year. You’re the one carrying out a good job.
I precisely wanted to say thanks once more. I’m not certain the things that I could possibly have worked on in the absence of those recommendations discussed by you regarding that area. It was actually a real troublesome case in my opinion, but being able to see the specialised technique you processed that took me to jump over gladness. I will be grateful for your advice and then have high hopes you know what a great job that you are undertaking instructing the others using your blog. I am certain you have never met all of us.
I want to express my affection for your kind-heartedness in support of women who really want help with this important matter. Your personal commitment to passing the message across became exceedingly invaluable and have frequently empowered individuals just like me to achieve their endeavors. Your amazing valuable guideline can mean this much a person like me and somewhat more to my office colleagues. Thanks a lot; from each one of us.
I am writing to make you understand what a terrific discovery my cousin’s princess obtained reading through your blog. She came to understand so many issues, most notably what it is like to have a very effective teaching mindset to make others without hassle completely grasp a variety of complicated matters. You actually surpassed our desires. Thank you for supplying such interesting, healthy, revealing and in addition unique tips about the topic to Kate.
I have to convey my gratitude for your kindness giving support to persons that need help with this one topic. Your very own commitment to passing the solution throughout came to be exceedingly functional and has usually permitted somebody like me to reach their aims. This helpful guideline entails a whole lot to me and a whole lot more to my peers. Best wishes; from all of us.
I do not know whether it’s just me or if perhaps everyone else experiencing problems with your website.
It appears as if some of the written text on your posts are running off the screen. Can somebody
else please comment and let me know if this is happening to them too?
This may be a issue with my web browser because I’ve
had this happen before. Many thanks
Thank you for great information
????? ?????? ??????
Thank you for great information
????? ?????