ssh 使用除了 $HOME/.ssh/known_hosts 之外的 known_hosts [英] ssh use known_hosts other than $HOME/.ssh/known_hosts

查看:41
本文介绍了ssh 使用除了 $HOME/.ssh/known_hosts 之外的 known_hosts的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用另一个 known_hosts 文件而不是用户的标准 $HOME/.ssh/known_hosts 文件运行 SSH?

Is it possible to run SSH using another known_hosts file than the standard $HOME/.ssh/known_hosts for the user?

请注意,SSH 为用户使用 $HOME 原件.如果您尝试更改它,例如

Note, that SSH uses $HOME original for the user. If you try to change it, e.g.

export HOME=some_other_location

它不会影响 SSH 用于查找 known_hosts 的位置.

it does not affect the location SSH uses to look for known_hosts.

推荐答案

您可以在 $HOME/.ssh/config/etc/ssh/ssh_config<中指定一个替代 known_hosts 文件/code>,参数UserKnownHostsFile.

或者,如果您更喜欢为特定的 SSH 调用使用替代 known_hosts 文件,您可以使用 SSH 命令选项 -o UserKnownHostsFile=<alternative known_hosts file>,例如ssh -o UserKnownHostsFile=~/my_temporary_known_host ssh_host.

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.

这篇关于ssh 使用除了 $HOME/.ssh/known_hosts 之外的 known_hosts的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆