I'm writing some integration tests, that test SSH connections between servers.
For the time being the tests are run from people's laptops. In order not to muck around in the user's (the user running the tests) ~/.ssh/config
I create a temporary directory with a bespoke ./tmp/.ssh/config
file just for the tests. Then I export HOME=/path/to/tmp
. Unfortunately, I've found that openssh doesn't use $HOME
to search for an ssh config or identity files.
This is ok if I'm ssh-ing directly to a host, because I can just explicitly set my config using the -F
flag. However, if I'm ssh-ing through a bastion and I have a proxycommand, ssh
does not pass that configuration file down to my proxycommand. So, if my bespoke ssh config uses a different default username (for example), that configuration won't be used for the proxycommand.
I "could" modify the proxycommand as well (to take an ssh config file as an argument), however, I'd like to know if it's possible to get openssh to look for the config/identity files in a different location just by use of environment variables (without having to pass the configuration file down to each subsequent downstream command). I can change my ssh-agent using SSH_AUTH_SOCK
so I was hoping to be able to change the config file directory as well.