0

I know this problem has been discussed several times in the forum but none of the steps recommended to remedy the problem have worked in my case.

In the following I will describe again the problem and then explain the (unsuccessful) measures I have taken so far to remedy the error.

I tried to check the functionality of my ssh server by connecting to it via the following command. After typing in the correct password, I am presented with this message:

$ ssh root@localhost
root@localhost's password: 
"Permission denied, please try again."

To remedy the problem I made the following change to the sshd_config file: I set:

PermitRootLogin yes

Then I restarted the SSH Server again by giving the command:

sudo service ssh restart

However, when trying to connect to the server I got the same response as before:

Permission denied, please try again.

I checked /etc/shadow and saw that there is an exclamation mark in front of the root user password (i.e. the password is locked). To unlock it I gave the command:

$ sudo usermod -U root
unlocking the user's password would result in a passwordless account.
You should set a password with usermod -p to unlock this user's password."

Hence, I gave the following command :

sudo usermod -p root

But the exclamation mark in front of the root password is still there and I still can't connect to the SSH server ... Is there anybody who knows what the solution to this problem is?

muru
  • 197,895
  • 55
  • 485
  • 740
  • I myself pointed out that this question has been asked before, but the problem is: the answers to these questions did not solve the problem in my case (although I tried all the steps recommended ... see the description of the measures I have taken) –  Jan 27 '15 at 17:00
  • have you set a password for root? sudo passwd? – muru Jan 27 '15 at 17:02
  • Thank you very much for this tip ... I typed in the command "sudo passwd" ... then I "updated" my password (My "new" password is the same as the "old" one though) .... Then I tried to connect to the ssh server again ... and this time it worked! ... I do not understand why it worked though. I had a password for sudo before (which I had to type in before I could type in my "new" password) ... Why did "updating" my password make it possible to connect to the ssh server? –  Jan 27 '15 at 17:12
  • Because the password sudo is your account's password, not the root accounts. When you did sudo passwd, you set root's password. – muru Jan 27 '15 at 17:13
  • See http://askubuntu.com/questions/9017/how-to-find-out-root-password-for-installing-software – muru Jan 27 '15 at 17:14
  • I see ... that explains everything. Thank you very much for your help! –  Jan 27 '15 at 17:19
  • For the sake of security you may want to limit ssh access to root account. If you must have it, then I would add AllowUsers root@192.168.1.* in /etc/sshd_config so you can only connect to root from local network. Or you can assign an exact ip to allow from – geoffmcc Jan 28 '15 at 00:55

0 Answers0