简体   繁体   English

root @ localhost权限被拒绝ssh

[英]root@localhost permission denied ssh

I installed ssh in my Ubuntu 14.04. 我在Ubuntu 14.04中安装了ssh。 I followed a tutorial for generating ssh keys. 我遵循了有关生成ssh密钥的教程。 I used following commands to set the keys. 我使用以下命令来设置键。

ssh-keygen -t rsa -P ""
cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys

when I type ssh localhost as a normal user it will not ask for any passwords and it works fine but when do it as a root it is asking for root@localhost password and my root password is not working. 当我以普通用户身份键入ssh localhost时,它不会要求输入任何密码,并且可以正常工作,但是当以root用户身份输入时,它会要求root @ localhost密码,而我的root密码不起作用。

Here is what I have tried so far by visiting some stackoverflow.com questions regarding this error. 到目前为止,这是我通过访问有关此错误的一些stackoverflow.com问题所尝试的方法。

  1. Everyone suggested to create a password by "sudo su" then "passwd". 每个人都建议通过“ sudo su”然后“ passwd”创建密码。 I tried it. 我尝试过这个。 I created a password and it's not working. 我创建了一个密码,但它不起作用。 I tried it several times. 我尝试了几次。

  2. I tried "ssh-add" as root but it says Could not open a connection to your authentication agent 我尝试以root用户身份使用“ ssh-add”,但提示Could not open a connection to your authentication agent

  3. I tried generating the keys as root by doing ssh-keygen -t rsa -P "" then cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys . 我尝试通过执行ssh-keygen -t rsa -P ""作为根来生成密钥,然后使用cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys After doing this when I start ssh localhost it is asking for root@localhost password and it is not accepting my root password. 完成此操作后,当我启动ssh localhost ,要求输入root @ localhost密码,并且不接受我的root密码。

  4. I tried changing PermitRootLogin to yes and withoutpassword. 我尝试将PermitRootLogin更改为yes和无密码。 both did not work. 两者都没有工作。

  5. I added a new property to the sshd_config saying AllowUsers root . 我在sshd_config中添加了一个新属性,即AllowUsers root It also did not work. 它也没有用。

Thanks in advance. 提前致谢。 I would really appreciate some help. 我真的很感谢您的帮助。

If u have not given password for root and you are trying to fire command on spark or haddop like ./sbin/stop-all.sh or ./sbin/start-all.sh . 如果您尚未提供root密码,而您正在尝试在spark或haddop上执行命令,例如./sbin/stop-all.sh./sbin/start-all.sh If you don't have a root password, you can setup one using 如果您没有root密码,则可以使用

sudo passwd

and fire commands. 和射击命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM