ssh remote forwarding auto reconnect
Hardware Box
=============================
serverA : with public ip
serverB : inner firewall
prepare : ssh, autossh(ServerB)
1. ServerB
#cd ~
go home directory
#ssh-keygen -t rsa
no passphrase (not that secure, but easy to setup)
you should now have the key pair in the .ssh directory (id_rsa & id_rsa.pub)
#cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_key_serverB
make a copy of your public key with the name 'authorized_key'
#scp ~/.ssh/authorized_key_serverB <remote user>@<ServerA's ipaddress>:'/<user's home dir>/.ssh/'
copy authorized_key to ServerA
2. ServerA
#cat ~/.ssh/authorized_key_serverB >> ~/.ssh/authorized_keys
3. ServerB
#autossh -i ~/.ssh/id_rsa -L 1234:localhost:6667 <remote user>@<ServerA's ipaddress>
<< ssh forwarding
#autossh -i ~/.ssh/id_rsa -R 8080:localhost:80 <remote user>@<ServerA's ipaddress>
<< ssh remote tunneling
#autossh -f -N -i ~/.ssh/id_rsa -R 9050:localhost:80 -R 9001:localhost:9001 -R 9049:localhost:22 <remote user>@<ServerA's ipaddress>
<< reality sample. without shell
댓글
댓글 쓰기