Just a note for myself because I always forget the syntax of setting up an SSH tunnel:
If you want to use a custom keypair, you first need to ensure they have the proper permissions:
1export PRIVATE_KEY=conf/ssh/id_rsa
2chmod g-r $PRIVATE_KEY
3chmod o-r $PRIVATE_KEY
Setting up the tunnel can then be done as follows:
1export LOCAL=127.0.0.1:3306
2export REMOTE=127.0.0.1:3306
3export DESTINATION=user@remote-server.com
4export PRIVATE_KEY=conf/ssh/id_rsa
5ssh -L $LOCAL:$REMOTE $DESTINATION -N -i $PRIVATE_KEY
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.