在配置此链接中指定的基于ssh密钥的认证时:https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2 ,但远程服务器的ssh仍然要求输入密码。
在运行“ ssh -v tstr410177”(主机为tstr410177)时,会收到以下消息:
OpenSSH_7.6p1, LibreSSL 2.6.2
debug1: Reading configuration data /Users/user_id/.ssh/config
debug1: /Users/user_id/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to tstr410177 port 22.
debug1: Connection established.
debug1: identity file /Users/user_id/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file /Users/user_id/.ssh/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH_5* compat 0x0c000000
debug1: Authenticating to tstr410177:22 as 'user_id'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: diffie-hellman-group-exchange-sha256
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: umac-64@openssh.com compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: umac-64@openssh.com compression: none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(2048<3072<8192) sent
debug1: got SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: got SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: ssh-rsa SHA256:flmSpzEnIi9Ndo634AbHnAoAaYpK48lgVbeXxwlJWes
debug1: Host 'tstr410177' is known and matches the RSA host key.
debug1: Found key in /Users/user_id/.ssh/known_hosts:1
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 4294967296 blocks
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: RSA SHA256:9SNPQPELhXMpR9NZXNUiSlpu3TyQl/TWxm0bAxhYY+Y /Users/user_id/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: password
user_id@tstr410177's password:
正在执行:ssh -o PasswordAuthentication = no tstr410177
user_id@tstr410177: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
我的userId是'user_id',远程主机是'tstr410177'。 “ .ssh”目录和其下文件的权限也已正确设置。