Skip to content

Instantly share code, notes, and snippets.

@orendon
Created February 12, 2014 13:40
Show Gist options
  • Select an option

  • Save orendon/8955738 to your computer and use it in GitHub Desktop.

Select an option

Save orendon/8955738 to your computer and use it in GitHub Desktop.
# Accessing my home machine from outside world
# on AWS
sudo vim /etc/ssh/sshd_config
GatewayPorts yes
sudo /etc/init.d/ssh restart
# check connections from outside (open port 7000 if needed)
netstat -ntl
# locally
ssh -i myfile.pem -R 7000:localhost:22 root@ec2-xxx-xxx.compute-1.amazonaws.com
# extras, skip password prompt and reconnect automatically
cat ~/.ssh/id_rsa.pub | ssh root@ec2-xxx-xxx.compute-1.amazonaws.com 'cat >> .ssh/authorized_keys'
autossh -f -N -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -i myfile.pem.pem -R 7000:localhost:22 root@ec2-xxx-xxx.compute-1.amazonaws.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment