SSH from hades to earth.server.com with the -R flag. I’ll assume that you’re the root user on hades and that tech will need the root user ID to help you with the system. With the -R flag, you’ll forward instructions of port 2222 on earth.server.com to port 22 on hades. This is how you set up an SSH tunnel. Note that only SSH traffic can come into hades: You’re not putting hades out on the Internet naked.
You can do this with the following syntax:
# ssh -R 2222:localhost:22 username@hades.server.com
Once you are into hades.server.com, you just need to stay logged in and enter a command like:
username@hades.server.com:~$ while [ 1 ]; do date; sleep 300; done
to keep the machine busy and minimize the window.
Now instruct your friends to SSH as “username” into earth.server.com without using any special SSH flags. You’ll have to give them your password:
root@hades:~# ssh username@earth.server.com .
BTW no need
Once user is on the hades.server.com, they can SSH to earth using the following command:
username@hades.server.com:~$: ssh -p 2222 root@localhost
Short form:
from earth: ssh -R 2222:localhost:22 username@hades.somedomain.com
then: while [ 1 ]; do date; sleep 300; done
from hades: ssh -p 2222 root@localhost
and we can log in into earth.somedomain.com :))