Found 1 entry, viewing 1 through 1.

Host Aliases in SSH

So you've probably got one or two hosts that you frequently ssh to that have long hostnames. You'd prefer to just alias this to something really short. There's a couple ways to do this:

  1. Hosts file alias. Problem: may overwrite something useful for other network connections.
  2. Shell alias. Problem: too many aliases.
  3. Good shell tab-completion. Problem: I can never get zsh to do intelligent ssh host completion.
  4. SSH configured alias.

So to create an alias for a system add to ~/.ssh/config the following:

Host <alias>
    HostName <real system fqdn>

Some examples:

Host s
    HostName scottr.org
Host b
    HostName 192.168.1.1

After a Host entry can be host specific configuration, and Host can be a pattern (Host *.slashdot.org). So for a host you could disable host key checking, or use a specific key file. Comes in pretty handy.

Permalink | 2 comments | Posted: Apr 18, 2008 | Tags: tips shell

Tags

42 | django | python | oggify | OSCON | OSCON07 | osx | utosc | mythtv | security | reading | music | gaming | programming | tips | shell | vim | pyobjc | cocoa | iphone | blog | git

Calendar

<< Jan >>
Mo Tu We Th Fr Sa Su
31 1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31 1 2 3

Search

This space reserved for a search box

A Django site. Hosted on a Slicehost Slice