使用 ssh 连接主机总是要求输入密码

使用 ssh 连接主机总是要求输入密码

我没有办法通过 SSH 成功连接到我们的实时服务器。根据管理员的说法,即使我的密钥被允许,它总是要求输入密码。

这是/etc/ssh/ssh_config

Host [server-host]
HostName [xxx.xxx.xxx.xxx]
User root
IdentityFile /home/gabriel/.ssh/[server-host]_rsa.pub

无论我如何尝试连接:

ssh [服务器名称]

ssh [服务器 IP]

ssh root@[server-ip] (这通常有效)

这些总是会提示我输入密码。

我已经将.ssh权限更改为700并将文件更改为600但毫无希望,我不知道还能做什么。我的机器上运行的是 Debian 8.8,服务器是 Ubuntu 14.04。我还创建了一个.ssh/config文件,但没有成功。

/etc/ssh/sshd_configPubkeyAuthentication是的并被AuthorizedKeysFile注释掉。我还能尝试什么?

输出-v

OpenSSH_6.7p1 Debian-5+deb8u3, OpenSSL 1.0.1t  3 May 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file /home/gabriel/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/gabriel/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/gabriel/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/gabriel/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/gabriel/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/gabriel/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/gabriel/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/gabriel/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.7p1 Debian-5+deb8u3
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8 pat OpenSSH_6.6.1* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr [email protected] none
debug1: kex: client->server aes128-ctr [email protected] none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA aa:14:7a:eb:5d:34:82:b8:4f:44:18:f1:db:63:1c:d1
debug1: Host 'xxx.xxx.xxx.xxx' is known and matches the ECDSA host key.
debug1: Found key in /home/gabriel/.ssh/known_hosts:1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/gabriel/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/gabriel/.ssh/id_dsa
debug1: Trying private key: /home/gabriel/.ssh/id_ecdsa
debug1: Trying private key: /home/gabriel/.ssh/id_ed25519
debug1: Next authentication method: password
[email protected]'s password: 

答案1

密钥被服务器拒绝。请检查服务器配置、错误并确保公钥已正确安装在 中~/.ssh/authorized_keys

相关内容