Ssh tunnel

From vpsget wiki
Revision as of 13:47, 4 March 2020 by Ndi (talk | contribs) (Created page with "<DRAFT> 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 <rem...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

<DRAFT>

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:127.0.0.1:3306 <user_name>@<serverIP>

For example:

ssh -p 22 -L 3307:127.0.0.1:3306 root@1.2.3.4


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:127.0.0.1:3306 root@1.2.3.4