2

sshfs mounts are shown under "devices" in Nemo and Nautilus, together with this eject/unmount button.

enter image description here

The eject/unmount button never works. When I go to the terminal and sshfs something into my home dir (for which I needn't sudo), the unmount button still has "permission denied". This has been the same for all Ubuntu versions since 16.04.

When I manually unmount the sshfs mount, the entire device entry disappears from the list, so I cannot re-mount it just by clicking on it.

Is there a way to manually add a "device", run a custom mount script when I click on it, and run a custom unmount script when I click on the eject/unmount button?

Redsandro
  • 3,674

2 Answers2

2

SSHfs unmount problem is known (see bug 254171 for Nautilus and bug 1763033 for Caja).

You can mount some network shares (SSH, FTP, SMB/CIFS) with help of GVFS by creating Bookmarks for them (something like smb://1.1.1.1/public_share). Such mounts will not require root/superuser access. From terminal you can access their files in /run/user/1000/gvfs/smb-share:server=localhost,share=public_share (or similar).

For custom scripts you can try to use Nautilus Action (or FileManager Actions). See this Q&A for details.

N0rbert
  • 99,918
2

An approach that circumvents the bug mentionned in the answer of NOrbert would be to declare the mount in /etc/fstab. Include your sshfs mount in /etc/fstab, and add the options noauto and users.

  • noauto causes the mount not to be carried out during the execution of fstab. Only the information needed for the mount is being declared to the system.
  • users declares that the mount can be performed by any user of the system. Use the option user=<uid> if you want to allow the mount only to a specific user.

To have the mounts appear in nautilus, you need to define the mount point under the /media folder or within your home folder.

vanadium
  • 88,010
  • This sounds good, except I would like to be able to launch a custom script. E.g. for mounting a ZFS dataset with an encryption key that is in the keyring of the user. Is there a hook that can do this? – Redsandro Oct 06 '18 at 20:35
  • Try it first. It may exactly behave as you expect, without the need for a custom script. – vanadium Oct 07 '18 at 06:04
  • I can't figure out how to specify a key as stored in the user keyring. – Redsandro Oct 09 '18 at 21:08
  • Search "mount sshfs" to learn how to mount and pass credentials. – vanadium Oct 10 '18 at 06:50