openssh-server
/etc/ssh/sshd_conf → Parameter “Port”/etc/init.d/ssh restart
ssh -p <port> <user>@<server>
Following lines create config file, which enables X forwarding. -X doesn't need to be typed anymore. In addition to that it forces the client to send a keep alive packet every 5 seconds.
cat >.ssh/config Host * ForwardAgent yes ForwardX11 yes ServerAliveInterval 5
ctrl+c finishes operation.
ssh-keygen -R <host>
removes the hostkey of <host> from ~/.ssh/known_hosts.
ssh -N -L 3307:<remotehost.com>:3306 <ssh_login>@<remotehost.com> or sometimes 3307:localhost:3306mysql -u<mysql_login> -p -P 3307 -h127.0.0.1
Aternative Way:
ssh -C -f -L 3307:localhost:3306 ssh_login@remotehost.com@<remotehost.com> sleep 10; mysql -u<mysql_login> -p -P 3307 -h127.0.0.1
This creates a auto-closing tunnel with compression (-C) enabled.