Tuesday, May 7, 2024
 Popular · Latest · Hot · Upcoming
78
rated 0 times [  78] [ 0]  / answers: 1 / hits: 307831  / 3 Years ago, sat, july 10, 2021, 9:23:11

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 also tried the same, by logging in through:



sudo -s


I use the same password as that I used to log in as user, but still am getting the same error message.



Could someone help me out here?



PS: I looked into This question but didn't seem to work for me.


More From » server

 Answers
0

By default, the SSH server denies password-based login for root. 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

Or, 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

[#24127] Monday, July 12, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
throecember

Total Points: 274
Total Questions: 118
Total Answers: 132

Location: India
Member since Thu, Jun 11, 2020
4 Years ago
;