0

I'm trying to mount a remote disk using SSHFS that is not directly accessible, i.e. I need to use a proxy, like local -> proxy -> remote. I'm using only key-based auth for both. The following command works:

sshfs -o IdentityFile='[PATH_TO_KEY_FOR_REMOTE]' -o ProxyCommand='ssh -q -i [PATH_TO_KEY_FOR_PROXY] -W %h:%p [PROXY_USER]@[PROXY]' [REMOTE_USER]@[REMOTE]:[SOURCE] [DESTINATION] 

Unfortunately, I can't get this to work as an entry in /etc/fstab; the current one is:

[REMOTE_USER]@[REMOTE]:[SOURCE] [DESTINATION] fuse.sshfs delay_connect,rw,noauto,_netdev,reconnect,ProxyCommand='ssh -q -i [PATH_TO_KEY_FOR_REMOTE] -W %h:%p [PROXY_USER]@[PROXY]',ServerAliveInterval=15,ServerAliveCountMax=3,IdentityFile=[PATH_TO_KEY_FOR_REMOTE]' 0 0 

but when running mount [DESTINATION], I get an error:

mount: /etc/fstab: parse error at line X -- ignored 

I've tried replacing ProxyCommand with ProxyJump, like so:

[REMOTE_USER]@[REMOTE]:[SOURCE] [DESTINATION] fuse.sshfs delay_connect,rw,noauto,_netdev,reconnect,ProxyJump=[PROXY_USER]@[PROXY],ServerAliveInterval=15,ServerAliveCountMax=3,IdentityFile=[PATH_TO_KEY_FOR_REMOTE]' 0 0 

This works for the command-line version, and mount [DESTINATION] doesn't report errors, but I keep getting Input/output error when trying to access it.

On the other hand, the below works when using mount [DESTINATION] (and if the key file for the proxy has been added to the SSH agent), but I'm still getting a prompt for the password (for the proxy) if mounting the remote graphically (XFCE 4):

[REMOTE_USER]@[REMOTE]:[SOURCE] [DESTINATION] fuse.sshfs rw,noauto,_netdev,ProxyJump=[PROXY_USER]@[PROXY],IdentityFile=[PATH_TO_KEY_FOR_PROXY],IdentityFile=[PATH_TO_KEY_FOR_REMOTE] 0 0 

Any ideas to make it work via the graphical prompt?

1 Answer 1

1

This answer from superuser.SE has the right idea; I had to make some modifications though, the right configuration seems to be (requires OpenSSH 7.3 or above):

~/.ssh/config

Host remote ProxyJump proxy HostName [REMOTE] User [REMOTE_USER] IdentityFile [PATH_TO_KEY_FOR_REMOTE] Host proxy HostName [PROXY] User [PROXY_USER] IdentityFile [PATH_TO_KEY_FOR_PROXY] 

/etc/fstab

remote:[SOURCE] [DESTINATION] fuse.sshfs rw,noauto,_netdev 0 0 

Owing to the previous unsuccessful connection attempts, gvfsd was hanging the file manager, so I also had to do killall gvfsd, which did the trick, and I can now automatically mount the remote without issues (both using mount [DESTINATION] and in the GUI).

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.