sshfs
mounts are shown under "devices" in Nemo and Nautilus, together with this eject/unmount button.
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?
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.
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
andusers
.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 optionuser=<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.