Sshfs

From Wiki

Revision as of 23:10, 7 October 2010 by Admin (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

sshfs - Mount a remote directory locally over ssh

In case you dont have samba on your remove server, in which case you could use smbmount, there is sshfs which will allow you to mount directory on a remote server over ssh.

Install

apt-get install sshfs
modprobe fuse
//if modprobe doesnt work - see below
//You may have to add "fuse" into /etc/modules
 
//by default for security reasons users cannot execute fusermount. Add select ones into the group fuse:
adduser username fuse
//the user may have to logout and log back in for the group permission to be picked up.

Syntax for Mounting

sshfs user@remote.server.com: /home/user/remotefolder

Mounting Problems & Ownership

If your UID is different on the remote box, you might not have permissions to read or write to the locally mounted folder. The following should work, but didnt :-/

sshfs -o uid=500,gid=500 me@myserver:/home/me /local/mount

Other things to try are shfsmount. Install it with apt-get install shfs-utils. It didnt work very far for me. Will get back to it again another time.

Syntax for UnMounting

fusermount -u /home/user/remotefolder
//logging out will also disconnect the remotefolder. It hung/didnt work for me however.

modprobe issues

If you are using a 2.4 kernel or something else, in which case the following returns a "Not found":

modprobe fuse

The following steps need to be carried out:

apt-get install module-assistant 
apt-get install fuse-source
cd /usr/src
m-a prepare
m-a a-i fuse
depmod -ae $(uname -r)
modprobe fuse

The above should add in the module fuse which is required. You may have to add "fuse" into /etc/modules

Update on sshfs

So I needed to use sshfs there recently. I was using debian lenny with a 2.6.26 kernel. All worked lovely. I had to add the option -o allow_others and then it worked a little better for what I was trying to do.

http://www.debianadmin.com/mount-a-remote-file-system-through-ssh-using-sshfs.html


Links

http://opensource.weblogsinc.com/2005/11/03/mount-remote-drives-via-ssh-with-sshfs/

http://www.linuxforums.org/forum/debian-linux-help/65233-fuse-modprobe-help.html

http://ubuntu.wordpress.com/2005/10/28/how-to-mount-a-remote-ssh-filesystem-using-sshfs/

Personal tools