完全相同的公钥私钥操作流程
ssh-keygen -t rsa 后,公钥已经上传,且完成 chmod 目录 700 和密钥 600
连接一台远端 vps(ubuntu 22.04),一切正常,不再需要密钥
但连接本地局域网另一台 mbp ,始终要求输入密钥。server/client 都是 MacOs Monterey 12.6.1
求助!
tim@tim_s-mbp ~ % ssh -v hilary@hilarymac.local
OpenSSH_8.6p1, LibreSSL 3.3.6
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/* matched no files
debug1: /etc/ssh/ssh_config line 54: Applying options for *
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Connecting to hilarymac.local port 22.
debug1: Connection established.
debug1: identity file /Users/tim/.ssh/id_rsa type 0
debug1: identity file /Users/tim/.ssh/id_rsa-cert type -1
debug1: identity file /Users/tim/.ssh/id_dsa type -1
debug1: identity file /Users/tim/.ssh/id_dsa-cert type -1
debug1: identity file /Users/tim/.ssh/id_ecdsa type -1
debug1: identity file /Users/tim/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/tim/.ssh/id_ecdsa_sk type -1
debug1: identity file /Users/tim/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /Users/tim/.ssh/id_ed25519 type -1
debug1: identity file /Users/tim/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/tim/.ssh/id_ed25519_sk type -1
debug1: identity file /Users/tim/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /Users/tim/.ssh/id_xmss type -1
debug1: identity file /Users/tim/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.6
debug1: compat_banner: match: OpenSSH_8.6 pat OpenSSH* compat 0x04000000
debug1: Authenticating to hilarymac.local:22 as 'hilary'
debug1: load_hostkeys: fopen /Users/tim/.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
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:xECOJFQQ3Rwk4Xg9QeD3yGZTE7ud71XhuBHGG/X0KPQ
debug1: load_hostkeys: fopen /Users/tim/.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
debug1: Host 'hilarymac.local' is known and matches the ED25519 host key.
debug1: Found key in /Users/tim/.ssh/known_hosts:12
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /Users/tim/.ssh/id_rsa RSA SHA256:uQhIb4LRrWFgk1EXuSBggqhaUsaaJYgzXDODnB2k810 agent
debug1: Will attempt key: /Users/tim/.ssh/id_dsa
debug1: Will attempt key: /Users/tim/.ssh/id_ecdsa
debug1: Will attempt key: /Users/tim/.ssh/id_ecdsa_sk
debug1: Will attempt key: /Users/tim/.ssh/id_ed25519
debug1: Will attempt key: /Users/tim/.ssh/id_ed25519_sk
debug1: Will attempt key: /Users/tim/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,webauthn-sk-ecdsa-sha2-nistp256@openssh.com>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/tim/.ssh/id_rsa RSA SHA256:uQhIb4LRrWFgk1EXuSBggqhaUsaaJYgzXDODnB2k810 agent
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: /Users/tim/.ssh/id_dsa
debug1: Trying private key: /Users/tim/.ssh/id_ecdsa
debug1: Trying private key: /Users/tim/.ssh/id_ecdsa_sk
debug1: Trying private key: /Users/tim/.ssh/id_ed25519
debug1: Trying private key: /Users/tim/.ssh/id_ed25519_sk
debug1: Trying private key: /Users/tim/.ssh/id_xmss
debug1: Next authentication method: keyboard-interactive
(hilary@hilarymac.local) Password:
第 1 条附言 · 2 天前
目前已经尝试:
@
xinge666 @
PbCopy111 已经用 ed25519 重新生成,放到 vps(ubuntu 22.04)上,依旧成功免密登录,但放到 MacOs 上依然失败。同时结合了 @
crab @
dingwen07 的建议,已经添加到 keychain ,且 remote login 临时设置允许对象为 full ,仍然要求密钥。 @
ETiV 用的 cp id_ed25519.pub .ssh/authorized_keys ,所以应该没有手工输入的错误,也谢谢建议。
服务器端和啰嗦模式,我都不熟悉怎么弄,再研究一下,谢谢大家!