Featured image of post Faster SSH Access to Remote Computers

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:

1
2
3
4
5
6
7
Host lab
  HostName MACHINE.IP.ADDRESS
  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.

Last updated on Feb 26, 2024 09:22 -0500
Feedback
FOOTER