SSH reverse tunneling

Questions about applications and software
Forum rules
Before you post please read this

SSH reverse tunneling

Postby Kent88 on Tue Apr 09, 2013 9:32 pm

I've been trying to test reverse ssh tunneling over my local network, but I'm not getting anywhere. In fact, it is just opening up a regular ssh connection.

I'm running the command from one machine (the one I want to connect to from a different machine):
ssh -R 2222:localhost:22 kent@192.168.0.100

and it is like the '-R 2222:localhost:22' is being ignored and it is just opening up a standard connection and session to 192.168.0.100 as if I typed in only:
ssh kent@192.168.0.100
Kent88
Level 1
Level 1
 
Posts: 36
Joined: Wed Dec 22, 2010 1:57 am

Linux Mint is funded by ads and donations.
 

Re: SSH reverse tunneling

Postby eanfrid on Wed Apr 10, 2013 5:05 am

You use the wrong port: the first command only activates the reverse tunnel waiting for connections on your localhost port 2222.

For example:
Code: Select all
user@CCCC$ ssh -R 4444:localhost:5555 user@AAAA
creates a reverse tunnel connecting AAAA/localhost:4444 to CCCC/localhost:5555. Then
Code: Select all
user@AAAA$ ssh user@localhost -p 4444
logs you on CCCC/localhost:5555

And this creates a man-in-the-middle using AAAA/localhost:4444:
Code: Select all
user@BBBB$ ssh -L 7777:localhost:4444 user@AAAA
tunnels BBBB/localhost:7777 to CCCC/localhost:5555 via AAAA and
Code: Select all
user@BBBB$ ssh user@localhost -p 7777
logs you also on CCCC/localhost:5555

(sorry multiple edits :D )
Main desktop: Debian GNU/Linux Wheezy 64bit w/custom 3.14 longterm kernel - MATE 1.8.1
(i5 2400@3.7GHz - 16GB DDR3 - HD6770 w/radeon driver - SSD+RAID1)
True private storage on SpiderOak
User avatar
eanfrid
Level 7
Level 7
 
Posts: 1764
Joined: Mon Apr 30, 2012 2:49 am
Location: U29tZXdoZXJlIG5lYXIgUGFyaXMsIEZyYW5jZQo=


Return to Software & Applications

Who is online

Users browsing this forum: elll, expat_tony and 34 guests