New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Comments
You could do ssh -L 3307:remote:3306 root@localhost but that seems kind of pointless, I think you can do better with iptables.
How do I forward a remote port to local with iptable? with encryption
Um, the command you pasted in your first post is the one you want then. It will create a port on your local server 3307 that is forwarded via SSH to localhost:3306 on the remote server. You can add -N if you don't want a shell, and then use screen or nohup to run in background.
What you do is perfectly fine. You can also use ssh -L 3306:localhost:3306 [email protected] right away. When connected to the remote host you can use the local 3306 port of the server on your client locally like localhost:3306. I use this for a lot of tunneling stuff because it's easy and encrypted through your ssh connection.
Yes. I am looking at a way to make it run in background
-N doesn't work.
It will just hang there
That is what it is supposed to do. Just do screen -S blue and then run the command in screen
Add -f -N to your command and you should be good. It'll connect and keep the tunnel open in the background.