为什么我不能以 root 身份使用 ssh?

为什么我不能以 root 身份使用 ssh?

我有两台服务器 A 和 B,它们位于同一个防火墙下。我可以使用 root 帐户从服务器 A 登录到 B,但无法从 B 登录到 A。我的 ssh 密钥配置正确,但我不知道哪里出了问题。

这是我尝试从服务器 B 连接到 A 时的详细信息。

root@web04:~# ssh -v -i.ssh/id_rsa [email protected]
OpenSSH_5.9p1 Debian-5ubuntu1.4, OpenSSL 1.0.1 14 Mar 2012
Warning: Identity file .ssh/id_rsa not accessible: No such file or directory.
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 11.11.11.4 [11.11.11.4] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: read_keyfile_line: /root/.ssh/id_dsa.pub line 1 exceeds size limit
debug1: identity file /root/.ssh/id_dsa type -1
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.4
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.4 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.4
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 2c:37:bc:c8:47:07:53:07:9c:a8:f8:1d:12:a6:4a:a0
debug1: Host '11.11.11.4' is known and matches the ECDSA host key.
debug1: Found key in /root/.ssh/known_hosts:11
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
Ubuntu 12.04 LTS
-------------------------------------
UNAUTHORISED ACCESS IS PROHIBITED!!
-------------------------------------
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Trying private key: /root/.ssh/id_dsa
debug1: read PEM private key done: type DSA
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Next authentication method: passwor

答案1

请检查 /etc/ssh/sshd_config 中的选项“PermitRootLogin”是否设置为“yes”。

请注意,这通常设置为“否”或“公钥”,因为通过 SSH 以 root 身份登录被广泛认为是一个安全问题。

相关内容