ssh use known_hosts other than $HOME/.ssh/known_ho

2019-03-08 18:51发布

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.

标签: ubuntu ssh
1条回答
手持菜刀,她持情操
2楼-- · 2019-03-08 19:47

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.

查看更多
登录 后发表回答