Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
known_hosts是否可以使用用户标准之外的其他文件运行 SSH $HOME/.ssh/known_hosts?
known_hosts
$HOME/.ssh/known_hosts
请注意,SSH 使用$HOME原始用户。如果您尝试更改它,例如
$HOME
export HOME=some_other_location
它不会影响 SSH 用于查找的位置known_hosts。
$HOME/.ssh/config您可以在或/etc/ssh/ssh_config参数中指定替代的 known_hosts 文件UserKnownHostsFile。
$HOME/.ssh/config
/etc/ssh/ssh_config
UserKnownHostsFile
或者,如果您更喜欢为特定的 SSH 调用使用替代 known_hosts 文件,您可以使用 SSH 命令选项-o UserKnownHostsFile=<alternative known_hosts file>,例如ssh -o UserKnownHostsFile=~/my_temporary_known_host ssh_host.
-o UserKnownHostsFile=<alternative known_hosts file>
ssh -o UserKnownHostsFile=~/my_temporary_known_host ssh_host