Toggle an SSH Config off or on with bash

terminal_icon_3dMy VPN at work is locked down to only allowing inbound and outbound traffic on port 22 to specific bastion servers, not to the entire internet. This means that if I am on the VPN, I need to have a ~/.ssh/config file to specify tunneling all connection through a bastion, but if I am NOT on VPN, I can not hit these bastion servers, so I need to move the config file out of the way before attempting to connect to a server via SSH.

This resulted in a LOT of the following:

And vice versa to move it back when I was on VPN. Because I’m lazy, I made this small bash utility and dropped it in my PATH as toggle_ssh_config.

Now, instead of using mv to move files back and forth, I just type tog<tab><enter> to toggle my SSH config off or on like this:

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">