简体   繁体   中英

root@localhost permission denied ssh

I installed ssh in my Ubuntu 14.04. I followed a tutorial for generating ssh keys. 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.

Here is what I have tried so far by visiting some stackoverflow.com questions regarding this error.

  1. Everyone suggested to create a password by "sudo su" then "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

  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 . After doing this when I start ssh localhost it is asking for root@localhost password and it is not accepting my root password.

  4. I tried changing PermitRootLogin to yes and withoutpassword. both did not work.

  5. I added a new property to the sshd_config saying 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 . If you don't have a root password, you can setup one using

sudo passwd

and fire commands.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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