Linux: Forward remote port to localhost port over ssh

There are times when you need to access a service on a remote server that does not have a firewall rule in place to allow direct connection from your end. If you have ssh access you can do the following.

In this examples we want to forward remote mysql server port 3306 to our machine(host) 3310

On host:

ssh -f -L3310:localhost:3306 sshUser@remoteserver -N

Test, backup remote DB through forwarded port:

mysqldump -P 3310 -h -u mysql_user -p database_name > backup.sql