Permission denied for root@localhost for ssh connection
I just installed Ubuntu 14.04 and LAMP on that. Then, I wanted to configure my server, so tried out This tutorial.
When i give the command
ssh root@localhost
I get : Permission denied, please try again. I have logged in as root user through the command :
sudo -i
I've also tried to log in to my account
sudo -s
I'm using the same password that i used to log in as a new user but i still get the same error message
Would anyone like to help me?
Ps i looked into this question but it didn't work for me
By default the ssh server does not allow password based access for root users In /etc/ssh/sshd_config
, if the following line exists, possibly commented out (with a #
in front).
PermitRootLogin without-password
Then change it to the following, uncommenting if needed (remove the #
in front).
PermitRootLogin yes
And restart ssh.
sudo service ssh restart
You can use ssh keys If you don't have one, create one using ssh-keygen
(stick to the default for the key, and skip the password if you feel like it). Then do sudo -s
(or whatever your preferred method of becoming root is), and add an SSH key to /root/.ssh/authorized_keys
.
cat /home/user/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys