Ssh tunnel

From vpsget wiki
Revision as of 14:16, 27 November 2021 by Ndi (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Create SSH tunnel (for example to access remote mysql database which listening only locally)

We get remote port 3306 to be able /listen locally on 3307

ssh -p <remote_ssh_port_number> -L 3307: <user_name>@<serverIP>

For example:

ssh -p 22 -L 3307: root@

Optionally You may want to add thise into server boot. foopr example add the next line into /etc/rc.local:

/bin/screen -d -m -S ssh_tunnel_to_production_srv /bin/ssh -p 4582 -L 3307: root@

EXAMPLE: Connect to your database via jump host or also could be called bastion host . Like establish tunnel to AWS RDS in private VPC via bastioon host:

ssh -i .\private.key -N -L  linux_user@ ( bastion host ip)

after that you should be able to connect to your RDS db using localhost ip