4

After upgrading my Mac to macOS Sierra (10.12.5), I upgraded FUSE for macOS (https://osxfuse.github.io) to the latest stable releases: FUSE for macOS 3.6.3 and SSHFS 2.5.0.

But now this no longer works:

$ sudo mkdir -p /Volumes/ssh_fs_5810 && sshfs dspitzer@dspitzer-5810:/home/CORP/dspitzer /Volumes/ssh_fs_5810/
mount_osxfuse: failed to mount /Volumes/ssh_fs_5810@/dev/osxfuse0: Operation not permitted

/Volumes/ssh_fs_5810 exists:

$ ls /Volumes
Macintosh HD ssh_fs_5810

Apparently sshfs now requires sudo:

$ sudo sshfs dspitzer@dspitzer-5810:/home/CORP/dspitzer /Volumes/ssh_fs_5810/
dspitzer@dspitzer-5810's password:

But now /Volumes/ssh_fs_5810/ is not visible without sudo:

$ ls /Volumes
ls: ssh_fs_5810: No such file or directory
Macintosh HD
$ sudo ls /Volumes
Macintosh HD    ssh_fs_5810
$ sudo ls /Volumes/ssh_fs_5810
.ICEauthority           .ssh
...

How do I make /Volumes/ssh_fs_5810/ (the directory I mount into using sudo sshfs) visible without sudo?

Update (addressing SteppingHat's comment):

Yes, the owner of /Volumes/ssh_fs_5810/ is root:

$ sudo ls -l /Volumes
Password:
total 16
lrwxr-xr-x  1 root      wheel     1 Aug 22 16:09 Macintosh HD -> /
drwxr-xr-x@ 1 root      wheel  4096 Aug 22 16:06 ssh_fs_5810

But this doesn't work:

$ sudo chown dspitzer:admin /Volumes/ssh_fs_5810/
chown: /Volumes/ssh_fs_5810/: Operation not permitted

And note above, /Volumes/ssh_fs_5810/ is visible after I create it using sudo, but not after sudo sshfs:

$ sudo umount -f /Volumes/ssh_fs_5810
$ sudo ls -l /Volumes
total 8
lrwxr-xr-x  1 root      wheel    1 Aug 22 16:09 Macintosh HD -> /
$ sudo mkdir /Volumes/ssh_fs_5810/
$ sudo ls -l /Volumes
total 8
lrwxr-xr-x  1 root      wheel    1 Aug 22 16:09 Macintosh HD -> /
drwxr-xr-x+ 2 root      wheel   68 Aug 22 18:05 ssh_fs_5810
$ ls /Volumes
Macintosh HD sh_fs_5810

Update #2 (in response to klanomath's "I've tested my alternative proposal..." comment on his answer below):

Here's what happened when I tried klanomath's alternative proposal:

$ ls /Volumes
Macintosh HD
$ sudo mkdir -p /Volumes/ssh_fs_5810
$ ls /Volumes
Macintosh HD ssh_fs_5810
$ sudo sshfs dspitzer@dspitzer-5810:/home/CORP/dspitzer /Volumes/ssh_fs_5810/
dspitzer@dspitzer-5810's password:
$ ls /Volumes
ls: ssh_fs_5810: No such file or directory
Macintosh HD
$ sudo chown dspitzer:admin /Volumes/ssh_fs_5810/
chown: /Volumes/ssh_fs_5810/: Operation not permitted
$ ls /Volumes
ls: ssh_fs_5810: No such file or directory
Macintosh HD
$ sudo ls /Volumes
Macintosh HD    ssh_fs_5810
  • 1
    This is probably because the user who own's the directory /Volumes/ssh_fs_5810 is root, and other users do not have write access to this directory. Try entering ls -l /Volumes to see the permissions on the directory. – SteppingHat Aug 23 '17 at 0:58
  • @SteppingHat I addressed your comment above. – Daryl Spitzer Aug 23 '17 at 1:08
5
+500

Create a mount point in your user's realm and mount it there:

mkdir -p ~/Shares/ssh_fs_5810 && sshfs dspitzer@dspitzer-5810:/home/CORP/dspitzer ~/Shares/ssh_fs_5810/

As an alternative you can add a sudo chown command after creating the mount point in your example (mounting to a subfolder of /Volumes):

... && sudo chown %user%:%group% /Volumes/ssh_fs_5810 ...

with %user%: dspitzer and %group%: staff (or admin - depends on your user privs).

The total command is then:

sudo mkdir -p /Volumes/ssh_fs_5810 && sudo chown dspitzer:admin /Volumes/ssh_fs_5810 && sshfs dspitzer@dspitzer-5810:/home/CORP/dspitzer /Volumes/ssh_fs_5810

Running this command for the very first time seems to be rocky sometimes. Connecting to the remote host via ssh first (to add the remote host to the known_hosts file) and/or adding two times sleep 0.5 in between may help.

  • Your first suggestion above works! I didn't expect that Mountain would list it as an ejectable volume, but it does. Note in the update to my question I showed that sudo chown doesn't work. If you remove this alternative from your answer (or address it), I'll accept your answer and award you the bounty. Thank you. – Daryl Spitzer Aug 25 '17 at 20:36
  • @DarylSpitzer I've tested my alternative proposal with the pkg installers of MacFuse 3.6.3/SSHFS 2.5.0 and the chown command worked after a hickup (only tested with two separate commands though: 1st sudo mkdir ... 2nd sudo chown ...(i.e. without the &&s)) – klanomath Aug 25 '17 at 20:50
  • See the "Update #2" I added to my question – Daryl Spitzer Aug 25 '17 at 21:04
  • You may want to change "As an alternative you can add..." to "As an alternative you may be able to add..." if you can't figure out why it works for you but not for me. Are you running macOS 10.12.5? – Daryl Spitzer Aug 25 '17 at 21:06
  • 1
    @DarylSpitzer My second proposal was ambiguous (obviously). You have to chown after mkdir and before running sshfs. I added the complete command. – klanomath Aug 25 '17 at 21:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .