大网数据广告活动
服务器运维问答

Why does SSH think I still have a 'known_hosts2' file?

· 52CE 我爱测

While trying to clean up my SSH config and key files on my iMac (macOS Monterey 12.1), I tried to SSH using the verbose flag (-v). This generated output including the following lines: ... debug1: load_hostkeys: fopen /Users/clint…

问题原文

原帖链接 · Clint Laskowski · CC BY-SA 4.0

While trying to clean up my SSH config and key files on my iMac (macOS Monterey 12.1), I tried to SSH using the verbose flag (-v). This generated output including the following lines:

...
debug1: load_hostkeys: fopen /Users/clint/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
...

I know that I tried to create a backup of my known_hosts file (and called it "known_hosts2") but I've since deleted it.

Does anyone know how can I find out why SSH still references (and thinks I have) an old file called 'known_hosts2'?

Thanks!

已采纳解答

原帖链接 · user2313067 · CC BY-SA 4.0

The default configuration for ssh in openssh has UserKnownHostsFile set to ~/.ssh/known_hosts and. ~/.ssh/known_hosts2. The config is similar for GlobalKnownHostsFile except it looks for these files in /etc/ssh as seen in the man page (https://www.man7.org/linux/man-pages/man5/ssh_config.5.html). So openssh ssh checks those 4 files by default which is what you see in ssh -v.

I'm not sure how much the configuration (and implementation) of MacOS SSH differs from openssh default, but at least in this case they seem to behave the same.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2022-01-29)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。