In principle it's the same as quinn's answer, but as a working script instead of separate commands which need adaption for each machine/usage.
I don't know about the overhead in this, it seems to me like it encrypts/decrypts everything twice.
#!/bin/bash
# Reverse sshfs. You need ssh servers on both ends, the script logs first
# onto the remote end and then back into the local one
# Usage: sshfsr dir [user@]host:mountpoint [options]
# [options] are passed on to the remote sshfs
set -e
LOCALPATH=$1
REMOTE=$(echo $2 | grep -o '^[^:]*')
REMOTEPATH=$(echo $2 | grep -o '[^:]*$')
ARGS=${@:3}
LOCALUSER=$(whoami)
PORT=10000
ssh $REMOTE -R $PORT:localhost:22 "sshfs -o NoHostAuthenticationForLocalhost=yes -p $PORT $ARGS $LOCALUSER@localhost:$LOCALPATH $REMOTEPATH" &
I disable HostAuthenticationForLocalhost because obviously localhost can be anything. This is perfectly safe with public key authentication. You shouldn't use passwords anyway, but even with passwords you are connecting to a host you know you control.
rsync -au --delete remote:path/ . && inotifywait -r -q -m -e close_write . | while read -r filename event; do rsync -au -r "$filename" remote:path/; done
. This assumes "remote" is configured in .ssh/config. When ran, it first updates local to match what's in the remote. Then, every time you make a change to a file, it syncs to the remote. This will not automatically resync when change are made in remote server. It's not really mounting, so not a real answer to the question. However, I don't want to install a new tool 'sshfs' for this. which is orphaned now