There is a computer that does not have a public IP that I want to make accessible for remote ssh login. This is machine A. I am logging in from a random machine B that could be anywhere in the world. Machine C is a public server that I have access to.
I create a user on machine C called
Then I add the following line to
/etc/ssh/ssh_config on machine C:
Don't forget to start the ssh server on machine A (may already be running):
user@machineA:~$ sudo systemctl enable sshd user@machineA:~$ sudo systemctl start sshd
Then I can run this command on machine A to connect it's local ssh port to machine C's port
user@machineA:~$ ssh -R \*:8000:localhost:22 fwd@machineC
To log in, execute on machine B to log into machine C:
user@machineB:~$ ssh fwd@machineC
Then execute on machine C to log in to machine A:
fwd@machineC:~$ ssh user@localhost -p 8000
Congratulations! You are now logged in to machine A from machine B anywhere in the world.
Credit to [https://serverfault.com/questions/88141/ssh-port-forwarding/88148](this serverfault post) for the original process.