Use SSHFS with shared control socket
It is possible.
Use -o ssh_command='ssh -S /full/path/to/ssh_socket'
. From man 1 sshfs
:
-o ssh_command=CMD
executeCMD
instead ofssh
.
sshfs placeholder:/remote/path /local/path -o ssh_command='ssh -S /full/path/to/ssh_socket'
Notes:
- In my Kubuntu the specified
ssh_command
runs in/
regardless of the directory I runsshfs
from. That's why this answer uses/full/path/to/ssh_socket
, not justssh_socket
. - If you use
ssh -S
without-M
, some options won't matter. The socket will matter in the first place. It is associated to some master connection where the port, the username and the host are already fixed. Therefore there is no need to use-p
and you can use almost any placeholder instead ofuser@host
. Even your secondssh
command could bessh -S ssh_socket -t whatever htop
. -
ssh://user@host:9022
syntax you used doesn't work withssh
from OpenSSH in my Kubuntu. What works is-p 9022 user@host
.