Is it possible to run SSH using another known_hosts
file than the standard $HOME/.ssh/known_hosts
for the user?
Note, that SSH uses $HOME
original for the user. If you try to change it, e.g.
export HOME=some_other_location
it does not affect the location SSH uses to look for known_hosts
.
You may specify an alternative known_hosts file in $HOME/.ssh/config
or /etc/ssh/ssh_config
, the parameter UserKnownHostsFile
.
Alternatively, if you prefer to use alternative known_hosts file for a specific SSH invocation, you may use the SSH command option -o UserKnownHostsFile=<alternative known_hosts file>
, e.g. ssh -o UserKnownHostsFile=~/my_temporary_known_host ssh_host
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With