An exceptionally newbie question, sorry. I'm running a Debian machine as root:


If I carefully change the password (over VNC), it seems to work:

debian:/# passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

If I then try to ssh in, carefully typing in the password I just set, I get 'Permission denied':

:~ ap257$ ssh root@XXX.XXX.XXX.XXX
root@XXX.XXX.XXX.XXX's password: 
Permission denied, please try again.
root@XXX.XXX.XXX.XXX's password: 
Permission denied, please try again.

What could be going wrong?


Solved, see my answer below (I can't accept it until tomorrow). Your thoughts on why on earth this worked would be very much appreciated!


Most likely the 'root' account is not permitted to log in via SSH.

Locate the config file, usually stored at


Look for the line that says

 PermitRootLogin No

Change it to say

PermitRootLogin Yes

Make sure you restart the SSH daemon after making the change!

service sshd restart
  • 6
    dont enable root to ssh, make other users and give them sudo permissions – JamesRyan Jul 7 '10 at 14:29
  • 1
    Or only permit key authentication – Maxfer Jul 7 '10 at 14:31
  • 1
    If you are security-conscious, yes best practice is to give a regular user sudo capabilities by adding the user to the '/etc/sudoers' file. – Mistiry Jul 7 '10 at 14:32
  • Hm. I don't have this file and 'find' doesn't produce anything by that name either. Do I need to install ssh? – AP257 Jul 7 '10 at 14:49
  • OK, done apt-get install ssh: opened sshd_config and edited: restarted ssh (using /etc/init.d/ssh restart). Still no joy, still getting 'Permission denied'. :( – AP257 Jul 7 '10 at 14:54

Create a new user with useradd, then set the passwd with passwd [user]. i.e.

useradd johndoe
passwd johndoe

Then SSH using johndoe, and then use the switch user command su - to get to root.

Note the dash. This is very important to set your environment like you probably want. Without the dash I believe you would end up at a prompt under root, but would have to use absolute paths. Normally the syntax is su [user], but the default is root if it is omitted.

Ideally you would also use Sudo, but the above is more proper than simply SSHing in under root. It is likely as mentioned in the other answers your sshd configuration disallows root login.

The reason root login is disallowed is because remote root access can be higher risk than needed security wise. Using the above method you would have to crack two layers to get root access, as opposed to just "knocking down the front door."

You can also look in /var/log/secure to see why your password was rejected.

  • Thanks for the explanation. But that doesn't help - still get 'Permission denied', even logging as my new user.... – AP257 Jul 7 '10 at 14:50
  • What does your /var/log/secure log say? (At the bottom) Or does this file not exist either? Try "tail /var/log/secure" – Joshua Enfield Jul 7 '10 at 14:54
  • No such file. It's a brand new Debian install, maybe that's why? – AP257 Jul 7 '10 at 14:59
  • hmmm, it should (provided usual vanilla SSH) have been created when you first tried to login, especially if you are getting permission denied. Edit: I looked it up and debian actually doesn't use a logger by default - doh me. It's a long shot, but does lastb show your login attempts on the server your trying to login to? (last would show your successful attempts) – Joshua Enfield Jul 7 '10 at 15:04
  • 2
    By default, this stuff should be logged to /var/log/auth.log – theotherreceive Jul 7 '10 at 15:15

I once had this problem. It was because root login was disallowed by the sshd configuration.

Ensure that PermitRootLogin is set to yes at /etc/ssh/sshd_config config file, although I'm not exactly sure if this is where it's found under debian


maybe that you got different keyboard mappings ?

try typing the password where you can see it.

  • good idea - but on inspection the passwords are the same... – AP257 Jul 8 '10 at 10:00

Thanks to everyone for all the suggestions. I eventually solved by chance, by typing

$ passwd root

and doing everything the same as before. I have no idea why this worked when

$ whoami
$ passwd

didn't. Can anyone explain?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy