我试图找出为什么我无法在学校的 UNIX 服务器上进行 SSH 公钥身份验证。我显然没有 root 访问权限,但我附加了详细的 SSH 输出以及客户端和主机 .ssh 目录的权限,以及显示密钥已上传的 ssh-copy-id。 Local的id_rsa.pub和Server的authorized_keys文件的内容完全匹配。我需要修复什么?
LOCALUSERNAME@LOCALUSERNAMEsMBP ~/.ssh ls -al
total 56
drwx------ 7 LOCALUSERNAME staff 224 May 27 20:01 ./
drwxr-xr-x@ 120 LOCALUSERNAME staff 3840 May 27 20:07 ../
-rw------- 1 LOCALUSERNAME staff 1766 Jun 3 2015 github_rsa
-rw-r--r-- 1 LOCALUSERNAME staff 399 Jun 3 2015 github_rsa.pub
-rw------- 1 LOCALUSERNAME staff 1675 Sep 8 2018 id_rsa
-rw-r--r-- 1 LOCALUSERNAME staff 401 Sep 8 2018 id_rsa.pub
-rw-r--r-- 1 LOCALUSERNAME staff 9244 May 25 21:01 known_hosts
ssh-copy-id MYUSERNAME@SERVER
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/Users/LOCALUSERNAME/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
MYUSERNAME@SERVER's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'MYUSERNAME@SERVER'"
and check to make sure that only the key(s) you wanted were added.
ssh -v MYUSERNAME@SERVER
OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to SERVER port 22.
debug1: Connection established.
debug1: identity file /Users/LOCALUSERNAME/.ssh/id_rsa type 0
debug1: identity file /Users/LOCALUSERNAME/.ssh/id_rsa-cert type -1
debug1: identity file /Users/LOCALUSERNAME/.ssh/id_dsa type -1
debug1: identity file /Users/LOCALUSERNAME/.ssh/id_dsa-cert type -1
debug1: identity file /Users/LOCALUSERNAME/.ssh/id_ecdsa type -1
debug1: identity file /Users/LOCALUSERNAME/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/LOCALUSERNAME/.ssh/id_ed25519 type -1
debug1: identity file /Users/LOCALUSERNAME/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/LOCALUSERNAME/.ssh/id_xmss type -1
debug1: identity file /Users/LOCALUSERNAME/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug1: Authenticating to SERVER:22 as 'MYUSERNAME'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:~~SOMESTRING~~
debug1: Host 'SERVER' is known and matches the ECDSA host key.
debug1: Found key in /Users/LOCALUSERNAME/.ssh/known_hosts:25
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: Will attempt key: /Users/LOCALUSERNAME/.ssh/id_rsa RSA SHA256:~~REDACTED ID_RSA~~
debug1: Will attempt key: /Users/LOCALUSERNAME/.ssh/id_dsa
debug1: Will attempt key: /Users/LOCALUSERNAME/.ssh/id_ecdsa
debug1: Will attempt key: /Users/LOCALUSERNAME/.ssh/id_ed25519
debug1: Will attempt key: /Users/LOCALUSERNAME/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/LOCALUSERNAME/.ssh/id_rsa RSA SHA256:~~REDACTED ID_RSA~~
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /Users/LOCALUSERNAME/.ssh/id_dsa
debug1: Trying private key: /Users/LOCALUSERNAME/.ssh/id_ecdsa
debug1: Trying private key: /Users/LOCALUSERNAME/.ssh/id_ed25519
debug1: Trying private key: /Users/LOCALUSERNAME/.ssh/id_xmss
debug1: Next authentication method: password
MYUSERNAME@SERVER's password:
MYUSERNAME@SERVER ~/.ssh ls -al
total 7
drwx------ 2 MYUSERNAME users 2048 Sep 8 2018 .
drwxr-xr-x 21 MYUSERNAME wheel 4096 May 27 20:07 ..
-rw------- 1 MYUSERNAME users 802 May 27 20:01 authorized_keys