sshfs-fuse-2

Rating: 
5
Your rating: None Average: 5 (6 votes)

(text from github.com/libfuse/sshfs)

About

SSHFS allows you to mount a remote filesystem using SFTP. Most SSH servers support and enable this SFTP access by default, so SSHFS is very simple to use - there's nothing to do on the server-side.

How to use

Once sshfs is installed (see next section) running it is very simple:

  sshfs [user@]hostname:[directory] mountpoint

It is recommended to run SSHFS as regular user (not as root). For this to work the mountpoint must be owned by the user. If username is omitted SSHFS will use the local username. If the directory is omitted, SSHFS will mount the (remote) home directory. If you need to enter a password sshfs will ask for it (actually it just runs ssh which ask for the password if needed).

Also many ssh options can be specified (see the manual pages for sftp(1) and ssh_config(5)), including the remote port number (-oport=PORT)

To unmount the filesystem:

  fusermount -u mountpoint

SailfishOS Tip:

The -o allow_other is needed to see the folders from different apps (thanks caribe for the tip). If You need custom ports etc. update Your .ssh/config

Application versions: 
AttachmentSizeDate
File sshfs-fuse-2.5-1.armv7hl.rpm41.37 KB24/03/2014 - 05:52
File sshfs-fuse-2.10-1.armv7hl.rpm34.53 KB11/12/2017 - 12:33
Changelog: 
  • Added .spec-file to build rpm-package
  • Changed the openrepos name from sshfs-fuse-2.5 to sshfs-fuse-2
  • (For source code changelog check sshfs-2.10 on github)

Comments

nobodyinperson's picture

Hint: Due to ssh not playing well with network switches or bad connectivity, make sure to <pre>fusermount -u mountpoint</pre> <strong>BEFORE</strong> anything bad might happen with the network. Otherwise you might get stuck with a frozen File Browser or even a non-responding Terminal app! :-O

olebr's picture

I will just argue about the phrases «not playing well» and «bad»: I feel You warning is to hard.
I guess no protocols are better in get through different networks than ssh. But because of it's nature trying to hold the connection as it is, it will get into trouble when You are the move.

So if You are on wifi, it's best to disconnect any ssh (tunnel) connections before leaving the area. And when You are on the move in a cellular network it's best to connect get Your files and disconnect. Because in cellular networks You don't know when You phone will connect to another base station.

Since this module is text only, I assume the user to be familiar with the terminal:
If You failed to disconnect before You moved and You got Your file access locked (hang) because of network change. You normally can disconnect by using <pre>fusermount -u mountpoint</pre>. If this fails because of «Device or resource busy». You can always just kill the process: <pre>killall sshfs</pre> (maybe You need to do a harder sighup <pre>killall -9 sshfs</pre>). Then Your application will get «Transport endpoint is not connected».

Last note about ssh and other long session protocols: When You have NAT somewhere in the connection, You need to send some data every couple of seconds. Else the NAT tables will lose You in their NAT-tables... So here config-parameters ServerAliveInterval / ServerAliveCountMax (keep alive) comes to help :-)

nobodyinperson's picture

Thanks for the in-depth explanation! Indeed, ssh is super  cool software and surely tries its best to avoid hangs, I dont't doubt that. It was just (and maybe this was caused by something else!) that for me, the File Browser froze when changing to the mobile network (which was bad anyway). When I then attempted to use the Terminal to do something about that (e.g. as you suggested, killing the ssh process), EVEN the Terminal was stuck and didn't accept any input. Hence my comment :-)

olebr's picture

I should have added an extra recommandation: don't have the mounting point directly on root (/) or home (/home/nemo) like this:  /home/nemo/my-ssh-server

Since when connection fails You often can't list the directory containing the mounting point. So maybe the terminal (or bash) does a directory listing on start. Else if You disconnect all internet connections (turn off wifi and celullar net) and then try to do ex. a listing, then the ssh session should be dropped since it has no network.

nobodyinperson's picture

Yes, that is a very good point! Thank you :-)

Where would you put the mount point instead? /media/sdcard/? /dev/shm?

klampfenfreak's picture

sshfs socket closing when I try to write to the remote folder. allow_other option is given. I am on Sailfish X but had same issues with my Intex Aqua Fish.

olebr's picture

Sorry for my late reply, but thank You for Your request. It made me speed up the for of installing Sailfish X... :-)

Have now compiled new rpm-package and uploaded here.
The name of the openrepos package was sshfs-fuse-2.5, but since the source relase is 2.10, I changed this.

Hope  this new rpm-package work better.

caribe's picture

If you can't browse mounted folders with File Browser or other application, try to add the "-o allow_other" option:

sshfs -o allow_other <user>@<host>:/ /<mpdir>

yoktobit's picture

Great, it works! Thanks!

olebr's picture

I can at moment just confirm: I also get empty directory when trying to open the directories from other apps.

Example: LLSvPlayer shows empty directories but files can be opened when called with file as argument directly from terminal.

At the moment it's just the sshfs-fuse source code compiled on a jolla. It is using fuse, does anyone know any other filesharing software which fuse - which exists as rpm for SailfishOS? To check if they got the same result.

yoktobit's picture

Thanks, connection works fine, I can browse my ssh folders via terminal. However, File Browser and Filetug just show an empty file at my mount point. Is my sshfs syntax wrong or is it something that both apps are doing wrong or even a Sailfish-SDK issue?

I'm using sshfs <user>@<host>:/ /home/nemo/<mpdir>