You work on your machine in office behind a nat happily, and you wanna login into your system after work like at home just for something little things. So, what should you do?

By searching on google, you find teamviewer, and what a program you may scream. Downloading, installing painfully (sure it is on linux), and you find your things finally. Is that awesome?
Yeah, it is awesome, apart from the installation and uncertain security, but what I wanna do is just accessing my files and has to be open to other strangers? How about ssh?

When coming to security, it’s time that you should turn to SSH, allowing you getting your files via a secure reverse tunnel, without exposing your privacy to others. In the meanwhile, SSH is usually installed by default, and you can easily setup a service for starting automatically.

Things are simple. For simplicity, suppose we have A in office behind a nat, B at home behind a nat too (most cases now), C a remote server with public IP - remote_addr which is required, if you haven’t, you can obtain from my Aff link: Vultr.

** A. Establishing a secure connection from B to C, **

ssh -gNfR remote_port:localhost:local_port user@remote_addr

and we have now a secure connection , and a reverse tunnel meanwhile. Make sure that you have installed ssh-daemond both on B and C, and starting the daemond.

** B. Login to C from A **

It’s a common ssh connection,

ssh user@remote_addr

** C. Login to B from C **

Using the previous connection from A to C,

ssh -p remote_port user@localhost

And now you are on B if everything goes well!! Have fun with your connection…