Faster SSH Access to Remote Computers

I routinely SSH into a company machine on Openstack to do work. Until yesterday, I’d use my Bash history to find the SSH command I needed to access it. I was reading SSH Mastery in a plane yesterday and realized I’ve been foolish to neglect the power of ~/ssh/config.

I added this to my SSH config file:

Host lab
  User tdhopper
  Port 22
  IdentityFile ~/.ssh/id_rsa
  ForwardAgent yes
  RemoteForward 52698 localhost:52698

Now I can connect to the machine by typing $ ssh lab. That’s it. I don’t have to provide the SSH key, username, or machine IP.

The RemoteForward bit also forwards a port to enable me to open files on the remote machine in my local SublimeText editor using rsub. This is great.