14

I try to log in with PuTTY as root, but when I type in the password it says access denied.

Can someone please help me fix this?

3
  • 1
    What have you tried? Did you verify you're connecting to the correct host? Is e password correct, or did you e.g. Change keyboard layouts? Can you log in using other users? Is SSH root login enabled or disabled?
    – Daniel Beck
    Jan 20 '13 at 22:51
  • As an addition to @DanielBeck's questions: Is root login enabled on the server? What's the /etc/ssh/sshd_config look like?
    – nerdwaller
    Jan 20 '13 at 23:05
  • I agree something like "I can log in just fine to that host with the user/pass that I know, using the hypervisor" but closing this question is too far.
    – DraxDomax
    Oct 18 '20 at 13:07
26

There are only four potential problem I can think of (most of which have been covered already):

You're not connecting to the right server.
  • If you're using an IP address, check it.

  • If you're using a host name, verify that it's pointing to the right IP address and/or try the IP address instead.

You're not entering the right username.
  • The fact that you have root access doesn't mean you can actually log in as root. It only means that you have an account with root privileges (normally via sudo).

  • If you're not entering the username manually, make sure Connection → Data → Auto-login username is actually set to root.

You're not entering the right password.
  • Check the password you're entering.

  • Verify that CapsLock is disabled.

  • Verify that PuTTY uses the proper keyboard layout.

  • Instead of Ctrl+V, try copying the password, then click inside the console and right click.

  • If you use AltGr, make sure Terminal → Keyboard → AltGr acts as Comopse key isn't checked.

  • If none of the above works, clear the field Connection → Data → Auto-login username (assuming it is set) and enter the password in the username field to verify it gets entered correctly.

Root access is disabled.

Some SSH servers can disable SSH logins for certain users and may even disable root logins by default. If you're using Open SSH server, you have to edit /etc/ssh/sshd_config and make sure that it doesn't contain one of the following lines:

    PermitRootLogin no
    PermitRootLogin without-password

Both result in a simple Access denied. error, although they permit you to enter the password. The latter only allows root logins when authenticating using public keys.

To permit root logins, remove the corresponding line or replace it with the following:

    PermitRootLogin yes

See man sshd_config for further information.

3
  • The root access was disabled for me, great answer!
    – Burgi
    Jul 11 '16 at 10:21
  • 2
    The 4th option worked for me as well. My /etc/ssh/sshd_config file did not contain either of the two lines that were mentioned, however I added the PermitRootLogin yes line to my file anyways and it worked. Make sure you restart your SSH service after making any modifications to that file (service ssh restart), so that they take effect.
    – Steph
    Sep 17 '17 at 19:52
  • Amazing answer and amazing comment by Steph! I was stuck and thought my goose is cooked, as I have a deadline for tomorrow... Using linux Alpine for vm... I also could not connect, didn't have the two PermitRootLogin things but I added one with 'yes'. Also worth mentioning that in my case, I had to restart sshd, not ssh. Happy days! Thank You!
    – DraxDomax
    Oct 18 '20 at 11:44
0

For me it was fail2ban that I had installed.

Solution: edit /etc/fail2ban/jail.local

The line with the entry ignoreip = must be edited. Put your IP / CIDR / DNS name in the box and the login should be possible again.

Not the answer you're looking for? Browse other questions tagged or ask your own question.