HR Geeks

Avatar

Hampton Roads Geek community

SSH Tricks

I’ve discovered a neat SSH trick / timesaver. You can create per-user ssh configuration files - ~/.ssh/config - which can contain host aliases.

For example, I SSH to ‘host.long.stupid.domain.com’ a lot. I can shorten this by putting:

Host myserv
HostName host.long.stupid.domain.com
User myDomainUser

into the configuration file. Now, I can do:

user:~>ssh myserv

and ssh will effectively run:

ssh myDomainUser@host.long.stupid.domain.com’

without having to type it all. Combine that with ssh keypairs (~/.ssh/authorized_keys2), and you can save a serious amount of typing!

One Comment, Comment or Ping

  1. joat

    Alternate method is to use shell aliases (Bash example):

    alias 757=”ssh yourname@757.org

    Can also be combined with keypair authentication.

Reply to “SSH Tricks”