root@localhost 的权限被拒绝

root@localhost 的权限被拒绝

我在运行 Ubuntu 14.04 LTS 的笔记本电脑上安装了 ssh

当我打开终端并输入“ssh localhost”时,它似乎工作正常,我得到了显示的通知和最后登录时间。如下所示

srimanth@srimanth-Inspiron-N5110:~$ ssh localhost
***************************************************************************
                            NOTICE TO USERS


This computer system is the private property of its owner, whether individual, corporate or government.  It is for authorized use only. Users (authorized or unauthorized) have no explicit or implicit expectation of privacy.

Any or all uses of this system and all files on this system may be intercepted, monitored, recorded, copied, audited, inspected, and disclosed to your employer, to authorized site, government, and law enforcement personnel, as well as authorized officials of government agencies, both domestic and foreign.

By using this system, the user consents to such interception, monitoring, recording, copying, auditing, inspection, and disclosure at the discretion of such personnel or officials.  Unauthorized or improper use of this system may result in civil and criminal penalties and administrative or disciplinary action, as appropriate. By continuing to use this system you indicate your awareness of and consent to these terms and conditions of use. LOG OFF IMMEDIATELY if you do not agree to the conditions stated in this warning.

**************************************************************************** Welcome to Ubuntu 14.04 LTS (GNU/Linux 3.13.0-24-generic i686)

 * Documentation:  https://help.ubuntu.com/

Last login: Sat Jan 24 21:43:06 2015 from localhost

但是,当我通过输入“sudo su”然后运行“ssh localhost”在终端中以 root 身份登录时,它要求我输入 root 密码,我多次输入了正确的密码,但收到提示“权限被拒绝”的消息。

srimanth@srimanth-Inspiron-N5110:~$ sudo su
[sudo] password for srimanth: 
xdpyinfo:  unable to open display "localhost:0.0".
root@srimanth-Inspiron-N5110/home/srimanth # ssh localhost
***************************************************************************
                            NOTICE TO USERS


This computer system is the private property of its owner, whether
individual, corporate or government.  It is for authorized use only.
Users (authorized or unauthorized) have no explicit or implicit
expectation of privacy.

Any or all uses of this system and all files on this system may be
intercepted, monitored, recorded, copied, audited, inspected, and
disclosed to your employer, to authorized site, government, and law
enforcement personnel, as well as authorized officials of government
agencies, both domestic and foreign.

By using this system, the user consents to such interception, monitoring,
recording, copying, auditing, inspection, and disclosure at the
discretion of such personnel or officials.  Unauthorized or improper use
of this system may result in civil and criminal penalties and
administrative or disciplinary action, as appropriate. By continuing to
use this system you indicate your awareness of and consent to these terms
and conditions of use. LOG OFF IMMEDIATELY if you do not agree to the
conditions stated in this warning.

****************************************************************************
root@localhost's password: 
Permission denied, please try again.
root@localhost's password: 
Permission denied, please try again.
root@localhost's password: 
Permission denied (publickey,password).

我通过“sudo passwd root”更改了密码。即使这样,我仍然收到相同的消息,提示权限被拒绝。我不知道 root 密码和 root@localhost 是否相同,也不知道我在哪里设置了 root@localhost 密码。我希望得到一些帮助。谢谢。

答案1

这里有类似的问题root@localhost 的 ssh 连接权限被拒绝

答案是

默认情况下,SSH 服务器拒绝 root 用户基于密码的登录。在 中/etc/ssh/sshd_config,更改:

PermitRootLogin without-password

PermitRootLogin yes

并重新启动 SSH:

sudo service ssh restart

相关内容