0

I'm running ubuntu 18.04.

I have a server that I SSH to, but I first need to turn on a VPN for that to work.

I want to enable other users to SSH to a port on my machine, in order for them to reach that VPN. So they ssh to port 12345(example) on my machine, and they are then on the remote machine.

So, a jumping point, I think.

So far, all attempts at using the -R option have failed.

How would I do this? What am I missing?

Consider the following:

  • My machine (A)
  • The server behind the VPN (B)
  • The machine of the person trying to use mine as a jumping point (C).

Both of the following commands have failed:

  • On A
    ssh -A -R 19999:localhost:22 B
    
  • On B
    ssh -R 19999:localhost:22
    

Edit: The VPN is a standard L2TP one that Windows allows you to set up.

4
  • Can you give examples of what you have tried? Oct 17, 2019 at 14:53
  • @WayneVosberg Examples added
    – KdgDev
    Oct 17, 2019 at 15:05
  • Is this a corporate VPN or a personal one? Many secured VPNs (especially corporate) will lock down what you can do with the network...especially to prevent a 3rd party from using your VPN connection to access their network (exactly what you are trying to do).
    – rtaft
    Oct 17, 2019 at 15:15
  • Question edited. And yeah I hadn't considered that yet.
    – KdgDev
    Oct 17, 2019 at 23:13

1 Answer 1

2

I think you want -L, not -R -- forward local port on your machine to remote port.

ssh -N -L 12345:<remote IP>:22 <remote user>@<remote IP>

Then, ssh -p 12345 <user>@<your machine> should get forwarded to port 22 on the remote system.

If you are running any firewalls you will need to be sure port 12345 is open on your machine as well.

2
  • I'm guessing they're going to have to send me their public key and I'm going to have to add that to authorized keys? Which means running a server instance?
    – KdgDev
    Oct 17, 2019 at 15:43
  • <user>@<your machine> will get forwarded to <user>@<remote machine. <user> doesn't need to exist on your machine, only on the remote machine. Whoever is establishing the connection would either need <user>@<remote machine>'s password or private key (authorized_keys on the remote machine would need the public key in that instance). I'm assuming the other people all have accounts on the remote machine -- otherwise you are looking at sharing your credentials, which is a whole other issue -- legally, ethically, and technically. Oct 17, 2019 at 15:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .