问题原文
原帖链接 · 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.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
