I've setup a Linux box at Work and trying to remote into it from Home using reverse SSH.
I've been reading a lot from Google searches and spent over 12 hours trying to do this, but can't figure it out. I don't know where my misunderstanding is coming from. Very good articles out there, but haven't worked for me or I'm doing it wrong.
My Setup - Test Environment
Home Network
WAN: 77.105.111.111 (Fake WAN for this post)
192.168.2.91 - Linux Server with SSH/xRDP (Call it middleman?)
192.168.2.100 - Windows Desktop
Work Network
WAN: 66.105.222.222 (Fake WAN for this post)
192.168.40.10 - Windows host with Virtualbox
192.168.40.146 - Debian 8 in Virtualbox from Windows Host
I have Debian 8 (192.168.40.146) installed on the Work Network on Virtualbox from a Windows Host. Later will use a Raspberry Pi at Work instead of VirtualBox once this is figured out.
On the Home Network I have port 22 forwarded to 192.168.2.91 (Linux SSH Server) on my router. Username on both Linux boxes is Ken. I've created SSH keys for no password login with Ken. Tested and working fine.
What I've done so far is do this on the Work Network Linux box (192.168.40.146):
ssh -R 2222:localhost:22 ken@77.105.111.111
Then at Home I use Putty to ssh into Linux SSH Server (192.168.2.91) from my home Windows desktop which is 192.168.2.100. My Home Linux SSH Server is the middleman from my understanding. Once I've used Putty to SSH into 192.168.2.91 I run the command:
ssh -l ken -p 2222 localhost
Then I'm prompted for password of Ken at Work and I'm reversed in with SSH.
Now this is fine. I can type shell commands on the Work Linux box now and do like ifconfig and stuff. Now I want to either RDP into my Work Windows computer or xRDP into the Work Linux virtualbox so I have a desktop. RDP and xRDP work fine locally while I'm at work.
I can't for the life of me get RDP or xRDP to work after doing the SSH reversal.
The way I'm understanding this, I need to create the reverse tunnel so I can reverse a connection from work to home to get around the work firewall. After that I want to RDP into my Work Windows computer. I haven't been able to do this so I installed XFCE and xRDP on the Work Linux virtualbox. Still can't get into Work Windows RDP or Linux xRDP. I've been using xRDP instead of straight up VNC for years now with no issue to get to my Linux desktops (not with reverse SSH yet).
So what I did next was think, okay I have a connection to my work computer at home with SSH so I'll create another tunnel from work to home.
ssh -L 33389:localhost:3389 ken@77.105.111.111
This give no error from the Work Linux virtualbox so I'm thinking good to go. Then from my Home Windows Putty login to my SSH box I try:
ssh -l ken -p 33389 localhost
OR
ssh -l ken -p 3389 localhost
and it goes to the next line, but doesn't ask for a login like if I used 2222 and seems stuck unless I ctrl+c.
I'm thinking maybe it's working, maybe not giving me the shell prompt because it's doing the tunnel. Back on Home Windows box (192.168.2.100) I've tried all the Putty settings for local/remote in SSH/Tunnels section, but doesn't work.
So I xRDP into my Home Linux SSH server (192.168.2.91) from my Home Windows box so I have an XFCE desktop. I try to rdesktop localhost:3389 and I've tried rdesktop localhost:33389 but no go.
I've tried all sorts of combinations from the Work Linux box (192.168.40.146), but none of them seem to work for me
Examples I've tried:
ssh -R 33389:192.168.40.10:3389 ken@77.105.111.111
ssh -R 33389:192.168.40.146:3389 ken@77.105.111.111
ssh -R 33389:localhost:3389 ken@77.105.111.111
ssh -R 22333:192.168.40.10:3389 ken@77.105.111.111
ssh -L 33389:192.168.40.10:3389 ken@77.105.111.111
ssh -L 33389:localhost:3389 ken@77.105.111.111
No errors doing any of this from Work Linux box. Doesn't help at all when I'm at Home though.
I hope I've explained this where it makes sense. Spent so much time on this I'm going brain dead.
Please someone help me.