問題描述

當超過 6 把 SSH 金鑰以後,登入 SSH Server 可能會發生以下錯誤

Too many authentication failures

解決辦法

修改 ~/.ssh/config,指定 host 要用哪一把 public key

~/.ssh/config
Host 192.168.1.1
        HostName 192.168.1.1
        User ubuntu
        IdentityFile "~/.ssh/server.pub"
        IdentitiesOnly yes
        IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"

後記

1Password 儲存超過 6 把金鑰時也會有相同的問題,除了第四行,也加上第六行即可

參考資料