Last Updated: February 25, 2016
·
2.04K
· jturolla

SSH your office's computer with reverse ssh tunnel.

On your office's computer:

sudo ssh -n -r 0.0.0.0:8022:localhost:22 username@your.digitalocean.com

From home, access it:

ssh companyusername@your.digitalocean.com -p 8022

2 Responses
Add your response

The public computer needs to have GatewayPorts enabled on the /etc/ssh/sshd_config, otherwise it wont work.

Add

GatewayPorts yes

In /etc/ssh/sshd_config

over 1 year ago ·

I think the remote option needs to be uppercase for starters. Also this opens up ssh access to your work host to world. You can limit this to localhost on your DO vm with:

sudo ssh -n -R 127.0.0.1:8022:localhost:22 username@your.digitalocean.com

The following command then would be

ssh -o ProxyCommand="ssh username@your.digitalocean.com nc localhost 8022" companyusername@companyofficecomputer

You need netcat installed on the DO host obviously.

over 1 year ago ·