1

What is the password to switch user to root. I just put the new ad card into rpi3b and in trying to su root I am asked for a password and I enter raspberry and get authentication error.

1
  • You CAN create a root password, as @joan suggested - however there is no need. Most of the experienced users DO NOT do this, but run commands with sudo when root access is needed.
    – Milliways
    Commented Nov 13, 2016 at 22:57

3 Answers 3

5

root user on Raspbian doesn't have a valid password at all. This is an intentional security measure which prevents someone from logging in as root to your board. Raspbian comes with a default pi user who has a password raspberry; once you change that password your RPi gets some basic security. Having a default root password would require you to change passwords for both users in order to secure your RPi.

You can set root password by running sudo passwd. This is only recommended if you want to play with login scripts of your pi user or sudo settings - having a root password will enable you to login and rescue your system if you accidentally lock yourself out of your pi account or break sudo (the latter specifically can only be fixed if you login as root). Otherwise I wouldn't do it.

2
  • 1
    "in Linux a user without a password isn't allowed to login at all" -> Not quite. Depending on how /etc/passwd and /etc/shadow are set-up, you can have a user with no password who can login by entering an empty password, or a user with no password who cannot login with any password. If you want to try the former with root, edit /etc/shadow and remove the asterisk from between the first set of colons, so that line begins root::. You can now login as root with no password. See man 5 shadow.
    – goldilocks
    Commented Nov 14, 2016 at 16:00
  • @goldilocks Thanks, I have (hopefully) fixed my answer by removing the wrong part. Commented Nov 14, 2016 at 16:09
1

If I remember correctly there is no root password by default.

If you want to login as root try

sudo su # login as root

passwd # set-up a root password
2
  • There's always a root user; pretty sure it's the only one that must exist. Although in a sense that might not be true if UID 0 is always presumed to be valid. Anyway, there is an explicit root on Raspbian, just password logins are disabled by default.
    – goldilocks
    Commented Nov 14, 2016 at 15:53
  • @goldilocks Yes, I was lax with my terms.
    – joan
    Commented Nov 14, 2016 at 16:01
-2

I tried different passwords then finally password is: raspberry

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