Monday, November 9, 2015

Creating a SSH tunnel

Saving tip for the future. To access your remote sever (DB server in this case) over a SSH tunnel, few steps needed:

1. Create/edit ~/.ssh/config
Add following to proxy all connections using the jump server to host foo
 ProxyCommand ssh exec nc %h %p 2> /dev/null

2. Create tunnel to target on port 3306 which will appear as 7777 on localhost
ssh -C -L dstat 10

3. Use SQL developer/workbench to now connect to localhost 7777

foo and remote could be same or different server above.
Good luck.