There are times when your machine is behind NAT and you couldn’t access easily. Unless you have VPN tunneling, it would be tricky. However, reverse
ssh might be a handy tool.
| Host A | ----> NAT ---> | Host B |
For above case, you can clearly see that B can access A easily, but reversely, it’s not w/o port forwarding blah blah blah. As a result, you can just do reverse
ssh by start
ssh from Host B to Host A with command
$ ssh -NR 8888:localhost:22 user@host-a
Then at Host A, you can just
ssh via port 8888.
$ ssh user@localhost -p 8888