SSHFS behind NAT

Table of Contents

system diagram

sshfs-behind-nat.png

Figure 1: System Diagram

Mount local directory to remote server

open a portforward when connect via ssh

ssh -R /tmp/$(id -n -u)_local.socket:localhost:22 schspa@remote.com

mount sshfs via unixsocket

sshfs -o ProxyCommand="socat - UNIX-CLIENT:/tmp/%r_local.socket" -o idmap=user,uid=$(id -u),gid=$(id -g) -o auto_unmount  schspa@localhost:/Volumes/work ~/work
Contact me via :)
虚怀乃若谷,水深则流缓。