23

I am trying to login to the raspberrypi as root user via winscp, but it only says "Access denied", same thing for trying to login directly as root on ssh.

I have tried loging in as pi and doing sudo passwd root, which results in the console output passwd: Password changed successfully, however I still can't login as root

37

If you want to login as root using SSH or WinSCP you need to edit the config of SSHD, do this:

  • Login, and edit this file: sudo nano /etc/ssh/sshd_config
  • Find this line: PermitRootLogin without-password
  • Edit: PermitRootLogin yes
  • Close and save file
  • reboot or restart sshd service using: /etc/init.d/ssh restart
  • Set a root password if there isn't one already: sudo passwd root

Now you can login as root, but I recommend you using strong password or ssh-keys

  • 2
    Note that if the PermitRootLogin line starts with a comment sign (#) you have to remove that sign! – jorijnsmit Apr 27 '18 at 7:17
  • I was helped the last line to set root password. Thanks. – Andrei Krasutski Aug 21 '18 at 7:12
3

You cannot login as root because Raspbian does not have a root password. See Raspbian root default password

Normally ssh does not allow root access because this is considered a security risk. You should be able to do everything you need using sudo (which is the normal Debian practice).

If you REALLY want ssh root access it can be enabled.

  • I'm very glad someone at least pointed out that this is a security risk. SSH as root is never a good idea (particularly when using password auth). – stevieb Sep 30 '16 at 14:24
1

You can login as normal user (belong sudoer group) then

 sudo su -

to switch to root

  • For ssh that's fine, the main problem was winscp where I can't just use sudo – d0min0r4bb1t May 29 '16 at 12:05
-2

You can

sudo su

Then use passwd to change the password

protected by Community Feb 20 '18 at 18:43

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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