Table of Contents

SSH

sudo aptitude install

openssh-server

Running SSH on non-standard port

  1. /etc/ssh/sshd_conf → Parameter “Port”
  2. /etc/init.d/ssh restart

Login on non-standard port ssh system

ssh -p <port> <user>@<server>

SSH Client

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.

Remove hostkey from known_hosts

ssh-keygen -R <host>

removes the hostkey of <host> from ~/.ssh/known_hosts.

SSH Tunnel (e.g. for remote MySQL)

  1. ssh -N -L 3307:<remotehost.com>:3306 <ssh_login>@<remotehost.com> or sometimes 3307:localhost:3306
  2. mysql -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.