Monday, August 6, 2018

SSH/SFTP Reverse Proxy



I have two machines accessible on the Internet with no NAT involved. Both machines run an SSH service.




I want to connect via SSH/SFTP to Server A on Port 2000 and this connection should be routed to Server B Port 22 (behavior like a HTTP reverse proxy but using SSH/SFTP instead of HTTP)



enter image description here


Answer



You can use ssh port forward for archive this



ssh -L localportinmypc:hostname_of_the_behind_the_firewall:remoteport hostname_of_my_firewall


Now after this:




sftp -o Port=localportinmyp localhost or ssh -p localportinmyp 

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...