APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

sshfs

I had read about sshfs in some magazine but hadn't got around to trying it out. A comment here (see comments at Fugu SSH/SFTP Client) triggered me to get off my butt and give it a spin.

You'll find sshf at http://fuse.sourceforge.net/sshfs.html. It requires FUSE, the user space file system. By the way, there are all kinds of other things built upon FUSE; you may want to poke around there.

Some small things that may need clarification:

The home page for sshfs says "This is a filesystem client based on the SSH File Transfer Protocol". True enough, but also it specifically depends upon sftp being enabled on the host you want to connect to. You'll find that in /etc/ssh/sshd_config (on the host you want to mount):

Subsystem sftp /usr/libexec/openssh/sftp-server

If that's commented out, uncomment it and do "kill -1 `cat /var/run/sshd.pid`"

Fuse needs /dev/fuse, which you can create with "sudo mknod -m 666 /dev/fuse c 10 229". If you run into problems with sshfs, /dev/fuse may not have rw permissions after you get done killing everything off, so you may need to sudo chmod it again.

Using sshfs looks something like this:

sshfs [email protected]: local_directory

If you don't want user's home directory as your root, say so:

sshfs [email protected]:/somedirectory local_directory

The FAQ implies that this can't handle symbolic links. In fact it can (this was done on a sshfs mounted Linux system):


$ ls -ld macstuff
lrwxrwxrwx 1 sam sam 5 Jul 13 07:57 macstuff -> ibook
$ cd macstuff
$ pwd -P
/home/apl/pcunix/ibook
$ pwd -L
/home/apl/pcunix/macstuff

But (and it's an important but), this apparently actually depends on the remote sftp, and strangely it's not as simple as whether or not sftp at the other end comprehends symbolic links.

The "other end" is quite important to your success with sshfs. For example, I connected to an older BSD system here. Sshfs couldn't traverse symbolic links (though sftp to the same system could) and it would hang dead if I attempted an "ls". However, I could work with files, and cd to any ordinary directory. Any "ls" would lock it up solid, though. A 'fusermount -uz' from another window would unmount it, but I had to reboot to get everything happy again.

When talking to a more up to date ssh, sshfs is crisp and boring unless something interferes with your connection. If that happens, 'fusermount -uz mountpoint" is necessary.

Other than basic failure to communicate or talking to an older sftp server, problems are likely to be in FUSE - keep that in mind when researching: chances are you are looking for an underlying FUSE issue rather than a specific sshfs problem.



Got something to add? Send me email.



3 comments



Increase ad revenue 50-250% with Ezoic


More Articles by

Find me on Google+

© Anthony Lawrence







Fri Jul 14 05:40:43 2006: 2254   drag


Heh. Pretty neat stuff.

You had a lot more problems with it then I did, though. :-/
Probably helps me out that all my boxes are fairly modern Linux systems.

I've noticed a couple other little things for it, for instance it can't do named pipes. But for the purposes of just being able to move and edit files without having to setup something complex like samba or introducing security hazards like nfs, then it's great.



Fri Jul 14 05:58:06 2006: 2255   drag


Oh, BTW. I forgot to mention other userspace filesystem like stuff. If your using KDE or Gnome they have their KIO (or IOslave) and Gnome-VFS stuff. (respectively).

This allows you to access files in a usermode fasion. I like fuse stuff a bit more personally since it's using traditional file system stuff and is accessable by normal programs, but if you like to use exclusively KDE or Gnome/GTK apps then these othe things can be nice. This stuff isn't aviable through the file system like sshfs is, but through file dialogs and such.

With gnome you can get to the stuff by openning up a nautilus window and hitting 'ctrl-l'. Once you have the location open you can type in 'ssh:[email protected]'. Or you can go through the start menu and go to places then 'connect to server'. And there it will give you a list of protocols it supports. (or if you have browser mode enabled in nautilus you can get through the file menu, I think)

Also with nautilus (at least the version I have in Debian Sid) it has support for that Zeroconf stuff. To my suprise when I enabled sftp on my desktop nautilus setup a icon for me in the 'networks' place. To get there you click on the 'home' (equivelent to my computer) icon and in there there will be networks and you click on that and it will show up. So that was pretty nice. (or you can go through the start menu and find it in 'places' as 'network servers' icon.

With KDE it's similar. You open up a konquerer window and this time it's 'fish:[email protected]'
They have some more information aviable at (link) since I don't use KDE that much. They also have oddball things like info: for accessing info files.



Tue Mar 8 15:30:45 2011: 9367   anonymous

gravatar


you can add the option -o follow_symlinks and then works!

------------------------
Kerio Samepage


Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us





The whole thing that makes a mathematician’s life worthwhile is that he gets the grudging admiration of three or four colleagues. (Donald Knuth)

It all sounds good from the pulpit,but come Monday morning all the sinners are back to business as usual writing crappy code. (Tony Lawrence)












This post tagged: