You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
794 B

---
layout: post
title: "reverse ssh"
author:
display_name: sipp11
login: sipp11
email: sipp11@gmail.com
url: ''
author_login: sipp11
author_email: sipp11@gmail.com
date: Feb 4, 2015
tags:
- ssh
- nat
---
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
ViolĂ !