Why does directory vanish when I do SSHFS?

I'm running Max OSX 10.9.3 and I'm trying to setup an SSHFS file-share between my MacBook Pro and a remote file system. However, when I try to do it, it doesn't work.

Strangely enough, it makes the target directory disappear. Has anyone else seen this happen? Is it a bug?

First see that I can ssh normally into the target machine:

% ssh [email protected]            # <--- SSH to remote system works! See below.
[email protected] % ls -altr remoteDir
total 8
drwxr-xr-x 26 remoteuser remoteuser 4096 Jun 22 01:00 ..
drwxrwxrwx  2 remoteuser remoteuser 4096 Jun 22 01:08 .
[email protected] % exit
%                                           # <--- Logged out of remote system

Next, I create a directory locally and verify it was created:

% pwd
/mnt

% ls
total 0
drwxr-xr-x  31 root  admin  1122 Jun 18 18:34 ../
drwxr-xr-x   2 root  admin    68 Jun 23 08:11 ./

% sudo mkdir share1 
% ls
drwxr-xr-x  31 root  admin  1122 Jun 18 18:34 ../
drwxr-xr-x   4 root  admin   136 Jun 23 08:50 ./
drwxr-xr-x   2 root  admin    68 Jun 23 08:50 share/

Now I try to setup the SSHFS share:

% sudo sshfs [email protected]:remoteDir /mnt/share1
[email protected]'s password:
%

Ok. It seems to have worked. No errors. So let's see the share we created, shall we?

% ls
ls: share1: No such file or directory
total 0
drwxr-xr-x  31 root  admin  1122 Jun 18 18:34 ../
drwxr-xr-x   3 root  admin   102 Jun 23 08:12 ./

What? Not only is the File Sharing not working, but the share1 directory seems to have vanished! (Although the file system seems to know it is missing, which is weird).

Where did /mnt/share1 go and how do I setup this SSHFS?


Solution 1:

On OSX you should run the mounting command as your own regular user, not root.

sshfs user@host:/ ~/sshfs -oauto_cache,reconnect,defer_permissions,noappledouble,negative_vncache,volname=MySSHFSMount

Solution 2:

This is very late, but I saw it because I googled the same issue. The problem seems to be that your system still thinks that the directory is mounted by the sshfs connection. What I did to solve the problem is use the following command in the Terminal umount -f /path/to/the/vanishing/directory.

Once you do that, your directory should be freed, and then you can go to your desktop and hold control and "right" click (two finger click) the finder icon, and choose relaunch. The directories will pop back up on your desktop.