我有一台 2013 款 MacBook Pro,在 MacOS 10.15.7 (19H2026) 上已经达到极限状态已经有一段时间了。它配置为接受无密码 SSH 连接。几天前,出乎意料的是,当我尝试通过 SSH 登录时,它开始提示输入密码。我正在使用运行 macOS Sonoma 14.2.1 的 MacBook Air(M1、2020)连接到 2013 款 MacBook Pro。
我已经验证过的事情:
~/.ssh
(700)、~/.ssh/id_rsa.pub
(644)~/.ssh/id_rsa
和~/.ssh/authorized_keys
(600)的权限- 中唯一未注释的行
/etc/ssh/sshd_config
是:AuthorizedKeysFile .ssh/authorized_keys UsePAM yes AcceptEnv LANG LC_* Subsystem sftp /usr/libexec/sftp-server XAuthLocation /opt/X11/bin/xauth
- 远程登录已启用。GUI 已停止工作,因此我必须使用此命令行解决方案,但我仍然可以通过提供密码登录。
- 我已经重新启动了 Catalina 盒子。
- 我的客户端是一台最新的 MacBook Air,仍然可以通过 SSH 访问在 Catalina 机器上的虚拟机中运行的最新 Linux。
- “什么都没有改变!我发誓!”
假设这些sshd_config
参数是正确的(文件的修改日期是 2023 年 6 月,我不知道这是我的修改还是系统更新),还有哪些其他可以尝试的事情?
更新:
这是以下的输出ssh -vvv <macbook-pro>
:
Air:~$ ssh -vvv retsina.local
OpenSSH_9.6p1, OpenSSL 3.2.1 30 Jan 2024
debug1: Reading configuration data /opt/homebrew/etc/ssh/ssh_config
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/Users/chap/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/Users/chap/.ssh/known_hosts2'
debug2: resolving "retsina.local" port 22
debug3: resolve_host: lookup retsina.local:22
debug3: channel_clear_timeouts: clearing
debug3: ssh_connect_direct: entering
debug1: Connecting to retsina.local [fe80::1b:28be:15d5:c41b%en0] port 22.
debug3: set_sock_tos: set socket 6 IPV6_TCLASS 0x48
debug1: Connection established.
debug1: identity file /Users/chap/.ssh/id_rsa type 0
debug1: identity file /Users/chap/.ssh/id_rsa-cert type -1
debug1: identity file /Users/chap/.ssh/id_ecdsa type -1
debug1: identity file /Users/chap/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/chap/.ssh/id_ecdsa_sk type -1
debug1: identity file /Users/chap/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /Users/chap/.ssh/id_ed25519 type 3
debug1: identity file /Users/chap/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/chap/.ssh/id_ed25519_sk type -1
debug1: identity file /Users/chap/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /Users/chap/.ssh/id_xmss type -1
debug1: identity file /Users/chap/.ssh/id_xmss-cert type -1
debug1: identity file /Users/chap/.ssh/id_dsa type -1
debug1: identity file /Users/chap/.ssh/id_dsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_9.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.1
debug1: compat_banner: match: OpenSSH_8.1 pat OpenSSH* compat 0x04000000
debug2: fd 6 setting O_NONBLOCK
debug1: Authenticating to retsina.local:22 as 'chap'
debug3: record_hostkey: found key type ED25519 in file /Users/chap/.ssh/known_hosts:1
debug3: record_hostkey: found key type ECDSA in file /Users/chap/.ssh/known_hosts:2
debug3: load_hostkeys_file: loaded 2 keys from retsina.local
debug1: load_hostkeys: fopen /Users/chap/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /opt/homebrew/etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /opt/homebrew/etc/ssh/ssh_known_hosts2: No such file or directory
debug3: order_hostkeyalgs: have matching best-preference key type [email protected], using HostkeyAlgorithms verbatim
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: [email protected],curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c,[email protected]
debug2: host key algorithms: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],rsa-sha2-512,rsa-sha2-256
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected],zlib
debug2: compression stoc: none,[email protected],zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1
debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected]
debug2: compression stoc: none,[email protected]
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:LPhM+eeposmTyzQiRXnh92AUZr/9MIrMgiW3VjLHCQM
debug3: record_hostkey: found key type ED25519 in file /Users/chap/.ssh/known_hosts:1
debug3: record_hostkey: found key type ECDSA in file /Users/chap/.ssh/known_hosts:2
debug3: load_hostkeys_file: loaded 2 keys from retsina.local
debug1: load_hostkeys: fopen /Users/chap/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /opt/homebrew/etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /opt/homebrew/etc/ssh/ssh_known_hosts2: No such file or directory
debug1: Host 'retsina.local' is known and matches the ED25519 host key.
debug1: Found key in /Users/chap/.ssh/known_hosts:1
debug3: send packet: type 21
debug2: ssh_set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: ssh_set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug3: kex_input_ext_info: extension server-sig-algs
debug1: kex_ext_info_client_parse: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug3: start over, passed a different list publickey,password,keyboard-interactive
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug3: ssh_get_authentication_socket_path: path '/private/tmp/com.apple.launchd.Ud5MvVC3io/Listeners'
debug1: get_agent_identities: bound agent to hostkey
debug1: get_agent_identities: ssh_fetch_identitylist: agent contains no identities
debug1: Will attempt key: /Users/chap/.ssh/id_rsa RSA SHA256:sEwBJnORX9BWQ5itF6CoX36w7jcl6E0Lcnkunvh4ew8
debug1: Will attempt key: /Users/chap/.ssh/id_ecdsa
debug1: Will attempt key: /Users/chap/.ssh/id_ecdsa_sk
debug1: Will attempt key: /Users/chap/.ssh/id_ed25519 ED25519 SHA256:S+OFCXTuvaLKr8CA0kcHonO7TfhP9L03jfohS2uIfZw
debug1: Will attempt key: /Users/chap/.ssh/id_ed25519_sk
debug1: Will attempt key: /Users/chap/.ssh/id_xmss
debug1: Will attempt key: /Users/chap/.ssh/id_dsa
debug2: pubkey_prepare: done
debug1: Offering public key: /Users/chap/.ssh/id_rsa RSA SHA256:sEwBJnORX9BWQ5itF6CoX36w7jcl6E0Lcnkunvh4ew8
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: /Users/chap/.ssh/id_ecdsa
debug3: no such identity: /Users/chap/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /Users/chap/.ssh/id_ecdsa_sk
debug3: no such identity: /Users/chap/.ssh/id_ecdsa_sk: No such file or directory
debug1: Offering public key: /Users/chap/.ssh/id_ed25519 ED25519 SHA256:S+OFCXTuvaLKr8CA0kcHonO7TfhP9L03jfohS2uIfZw
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: /Users/chap/.ssh/id_ed25519_sk
debug3: no such identity: /Users/chap/.ssh/id_ed25519_sk: No such file or directory
debug1: Trying private key: /Users/chap/.ssh/id_xmss
debug3: no such identity: /Users/chap/.ssh/id_xmss: No such file or directory
debug1: Trying private key: /Users/chap/.ssh/id_dsa
debug3: no such identity: /Users/chap/.ssh/id_dsa: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup keyboard-interactive
debug3: remaining preferred: password
debug3: authmethod_is_enabled keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug2: userauth_kbdint
debug3: send packet: type 50
debug2: we sent a keyboard-interactive packet, wait for reply
debug3: receive packet: type 60
debug2: input_userauth_info_req: entering
debug2: input_userauth_info_req: num_prompts 1
([email protected]) Password:
更新2:
添加~/.ssh/config
到 MacBook Air 后,这里再次是 SSH 的输出:
Air:~/.ssh$ ssh -vvv retsina.local
OpenSSH_9.6p1, OpenSSL 3.2.1 30 Jan 2024
debug1: Reading configuration data /Users/chap/.ssh/config
debug1: /Users/chap/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /opt/homebrew/etc/ssh/ssh_config
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/Users/chap/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/Users/chap/.ssh/known_hosts2'
debug2: resolving "retsina.local" port 22
debug3: resolve_host: lookup retsina.local:22
debug3: channel_clear_timeouts: clearing
debug3: ssh_connect_direct: entering
debug1: Connecting to retsina.local [fe80::1b:28be:15d5:c41b%en0] port 22.
debug3: set_sock_tos: set socket 6 IPV6_TCLASS 0x48
debug1: Connection established.
debug1: identity file /Users/chap/.ssh/id_rsa type 0
debug1: identity file /Users/chap/.ssh/id_rsa-cert type -1
debug1: identity file /Users/chap/.ssh/id_ecdsa type -1
debug1: identity file /Users/chap/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/chap/.ssh/id_ecdsa_sk type -1
debug1: identity file /Users/chap/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /Users/chap/.ssh/id_ed25519 type 3
debug1: identity file /Users/chap/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/chap/.ssh/id_ed25519_sk type -1
debug1: identity file /Users/chap/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /Users/chap/.ssh/id_xmss type -1
debug1: identity file /Users/chap/.ssh/id_xmss-cert type -1
debug1: identity file /Users/chap/.ssh/id_dsa type -1
debug1: identity file /Users/chap/.ssh/id_dsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_9.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.1
debug1: compat_banner: match: OpenSSH_8.1 pat OpenSSH* compat 0x04000000
debug2: fd 6 setting O_NONBLOCK
debug1: Authenticating to retsina.local:22 as 'chap'
debug3: record_hostkey: found key type ED25519 in file /Users/chap/.ssh/known_hosts:1
debug3: record_hostkey: found key type ECDSA in file /Users/chap/.ssh/known_hosts:2
debug3: load_hostkeys_file: loaded 2 keys from retsina.local
debug1: load_hostkeys: fopen /Users/chap/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /opt/homebrew/etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /opt/homebrew/etc/ssh/ssh_known_hosts2: No such file or directory
debug3: order_hostkeyalgs: have matching best-preference key type [email protected], using HostkeyAlgorithms verbatim
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: [email protected],curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c,[email protected]
debug2: host key algorithms: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected],zlib
debug2: compression stoc: none,[email protected],zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1
debug2: host key algorithms: rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,[email protected]
debug2: compression stoc: none,[email protected]
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:LPhM+eeposmTyzQiRXnh92AUZr/9MIrMgiW3VjLHCQM
debug3: record_hostkey: found key type ED25519 in file /Users/chap/.ssh/known_hosts:1
debug3: record_hostkey: found key type ECDSA in file /Users/chap/.ssh/known_hosts:2
debug3: load_hostkeys_file: loaded 2 keys from retsina.local
debug1: load_hostkeys: fopen /Users/chap/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /opt/homebrew/etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /opt/homebrew/etc/ssh/ssh_known_hosts2: No such file or directory
debug1: Host 'retsina.local' is known and matches the ED25519 host key.
debug1: Found key in /Users/chap/.ssh/known_hosts:1
debug3: send packet: type 21
debug2: ssh_set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: ssh_set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug3: kex_input_ext_info: extension server-sig-algs
debug1: kex_ext_info_client_parse: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug3: start over, passed a different list publickey,password,keyboard-interactive
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug3: ssh_get_authentication_socket_path: path '/private/tmp/com.apple.launchd.Ud5MvVC3io/Listeners'
debug1: get_agent_identities: bound agent to hostkey
debug1: get_agent_identities: ssh_fetch_identitylist: agent contains no identities
debug1: Will attempt key: /Users/chap/.ssh/id_rsa RSA SHA256:sEwBJnORX9BWQ5itF6CoX36w7jcl6E0Lcnkunvh4ew8
debug1: Will attempt key: /Users/chap/.ssh/id_ecdsa
debug1: Will attempt key: /Users/chap/.ssh/id_ecdsa_sk
debug1: Will attempt key: /Users/chap/.ssh/id_ed25519 ED25519 SHA256:S+OFCXTuvaLKr8CA0kcHonO7TfhP9L03jfohS2uIfZw
debug1: Will attempt key: /Users/chap/.ssh/id_ed25519_sk
debug1: Will attempt key: /Users/chap/.ssh/id_xmss
debug1: Will attempt key: /Users/chap/.ssh/id_dsa
debug2: pubkey_prepare: done
debug1: Offering public key: /Users/chap/.ssh/id_rsa RSA SHA256:sEwBJnORX9BWQ5itF6CoX36w7jcl6E0Lcnkunvh4ew8
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: /Users/chap/.ssh/id_ecdsa
debug3: no such identity: /Users/chap/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /Users/chap/.ssh/id_ecdsa_sk
debug3: no such identity: /Users/chap/.ssh/id_ecdsa_sk: No such file or directory
debug1: Offering public key: /Users/chap/.ssh/id_ed25519 ED25519 SHA256:S+OFCXTuvaLKr8CA0kcHonO7TfhP9L03jfohS2uIfZw
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: /Users/chap/.ssh/id_ed25519_sk
debug3: no such identity: /Users/chap/.ssh/id_ed25519_sk: No such file or directory
debug1: Trying private key: /Users/chap/.ssh/id_xmss
debug3: no such identity: /Users/chap/.ssh/id_xmss: No such file or directory
debug1: Trying private key: /Users/chap/.ssh/id_dsa
debug3: no such identity: /Users/chap/.ssh/id_dsa: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup keyboard-interactive
debug3: remaining preferred: password
debug3: authmethod_is_enabled keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug2: userauth_kbdint
debug3: send packet: type 50
debug2: we sent a keyboard-interactive packet, wait for reply
debug3: receive packet: type 60
debug2: input_userauth_info_req: entering
debug2: input_userauth_info_req: num_prompts 1
([email protected]) Password:
/Users/chap/
我注意到MacBook Pro (10.15.7) 上的权限是 777。将它们更改为 755 修复了所有问题。I'm not certain when or how the permissions were changed, or what else could have changed so that these incorrect permissions were now causing public key SSH authentication to fail. The System Information Software Installation log lists nothing more recent than MacOS Catalina Security Update 2022-005, applied 8/27/2022. I log in to this machine every day, and the login failure began only several days ago.
Update: Something did change:
I have a special, dedicated user on the Catalina machine where I run Homebrew. However, it's not the user I was having trouble with. I figured that, just like in more recent versions of macOS, I could enable the presence of Homebrew by simply adding its installation directory to the
$PATH
variable in.bash_profile
. On Sonoma, it's/opt/homebrew
. On Catalina and earlier, it's/usr/local/bin
.For the user I was having trouble SSH’ing into, I had omitted appending
/usr/local/bin
from$PATH
, intending to eliminate any Homebrew related installs from the mix.I was wrong.
It turns out that the system — that is, macOS — prepends
/usr/local/bin
to$PATH
automatically.Furthermore, when I recently ran
brew upgrade
, it upgradedopenssl
:So all along, every SSH user on my Catalina has been accessing OpenSSL provided by Homebrew, and it was recently updated. I don't know precisely how this changed the way SSH worked, but it seems very likely that a recent Homebrew upgrade was somehow responsible for this problem.
Caveat Homebrewer!
正如OSXDaily 上的这篇文章所解释的:
因此,要解决此问题,请在 MacBook Air 上编辑/创建此文件;权限
644
(又名-rw-r--r--
:):现在添加以下内容:
保存并再次尝试通过 SSH 连接到 MacBook Pro。它应该有效。如果没有,请编辑您的问题以添加 SSH 的详细输出,如下所示:
当然是
[hostname]
与 MacBook Pro 的 IP 地址或主机名交换。更新:如果我建议的原始版本
~/.ssh/config
不起作用,请尝试使用第三种设置PubkeyAcceptedKeyTypes
: