bgtunnel
bgtunnel copied to clipboard
Specify ssh config file and/or known_hosts location?
I'm trying to relocate the ssh keys to another folder instead of the default on Linux. Currently I can use the identity_file kwarg to specify which private key file to use, but this only works if the known_hosts file is still in its original folder.
I've tried making a config file with both the identity file and known hosts file paths specified, but this does not work as the identity_file:
IdentityFile *path1*
UserKnownHostsFile *path2*
Is there a way to specify the known_hosts location, or a config file?
Edit: Per the ssh manual page specifying the config is an existing option:
-F configfile
Specifies an alternative per-user configuration file. If a
configuration file is given on the command line, the
system-wide configuration file (/etc/ssh/ssh_config) will
be ignored. The default for the per-user configuration
file is ~/.ssh/config. If set to “none”, no configuration
files will be read.
It looks like this could be added very similarly to how identity_file is.
An additional/alternative option is to add -o, which allows (among other things) UserKnownHostsFile to be specified:
-o option
Can be used to give options in the format used in the
configuration file. This is useful for specifying options
for which there is no separate command-line flag. For full
details of the options listed below, and their possible
values, see ssh_config(5).
Added a pull request to address the issue by adding a config_file option. The config file can contain paths to the identity and known hosts files, so it solves the issue for me.