Let's also say you have a Linux instance you SSH to that needs to connect back to you own laptop or another Linux machine, but the port on your local machine cannot be accessed from the remote Linux box unless you have IT open that port, which means bugging them with a ticket.
Here's something I learned the other day.
In my scenario I needed to connect to a web application, running on my local Mac Book Pro, using port 9999 when I was connected via VPN, from a Linux Openstack instance.
Unfortunately, I couldn't connect to the port with a simple program like curl since the port was blocked.
Here are the steps so I could allow SSH to serve up that port from the remote Linux instance back to my Mac.
Detailed Steps:
You need two terminal windows on the machine you need to connect back to. I had two tabs open in the Terminal window on my Mac.
1st terminal window:
Change this string to what port you need to open >
ssh -R 9999:localhost:9999
If you don't want to use localhost, replace with server name you want to connect back to.
You will now be on the remote linux box
2nd terminal window:
ssh [root or whoever you connect as]@[the virtual server you connect to]
You will now be on the remote linux box in the 2nd terminal window.
Try using curl to test the port that you want to connect back to >
curl https://localhost:9999/
Again, replace localhost with whatever server name you'd like to use to connect back to.
No comments:
Post a Comment