Aliases

by editing ~/.ssh/config, you can make SSH aliases very simply:

Host shortname
        HostName        longname.domain.tld
        Port            22
        User            username

typing “ssh shortname” will be the same as “ssh username@longname.domain.tld” (even if shortname is not defined in the DNS nor in the /etc/hosts file)

Bounce hosts

Here we use a publicaly available IP host to reach a private host, using a single command. For this to work you have to add something like that in ~/.ssh/config:

Host hostname
        ProxyCommand    ssh username@longname.domain.tld nc distant_private_ip_adress 22
        User            username

“ssh hostname” connects to the distant_private_ip_adress adress server using the public longname.domain.tld host. Of course netcat must be installed on the public server.

Tunnels

We can map distant ports on localhost local ports, using a bounce host:

ssh -L 8080:server_to_forward_ports_of:80 server_to_connect_to

once connected to server_to_connect_to, localhost:8080 would be the same as server_to_forward_ports_of:80.

SOCKS proxies

ssh -D 8080 server_to_connect_to

once connected to server_to_connect_to, use localhost:8080 as the (SOCKS v4) proxy server in your favorite browser.

Using a local proxy to enable internet access on a remote host

  • install some proxy software (i.e., Squid)
  • connect to the server, and map a port to the proxy's one:

ssh -R8181:localhost:3128 server_to_connect_to

  • once connected, enter:

export http_proxy=http://127.0.0.1:8181

  • surf
  • Bookmark "Aliases" at del.icio.us
  • Bookmark "Aliases" at Digg
  • Bookmark "Aliases" at Google
  • Bookmark "Aliases" at Facebook
  • Bookmark "Aliases" at Twitter