Quick Tip: SSH Config

It’s easy to create shortcuts for all those servers you need to SSH into. There should be a file in your .ssh directory called config. Simply add a few lines to this file and you can refer to those servers by their short name.

Example (~/.ssh/config)

Host foo
  Hostname some.long.hostname.you.cannot.remember.com
  User myuser
  Port 1234

Now you can use your new host when you SSH.

ssh foo

If you want to get even fancier, read the man page for additional options.

man ssh_config

Setup as many as you need and free yourself from SSH hostname hell!

Posted August 23rd, 2008 at 5:42 am in Programming | Permalink

2 comments:

  1. Ben Atkin:

    Wow. I never heard about that until now. Thanks for sharing! It’s going to make using sftp a lot less painful.

  2. Keith Fligg:

    Hmmm. NIce Curtis. I always just create an alias in by .bash_profile, but this seems cleaner.

Leave a response: