rfmorse
Posts: 1
Joined: Fri Aug 25, 2017 3:02 pm

root password for Raspbian

Fri Aug 25, 2017 3:22 pm

In attempting to install HP printer support, I'm asked for the root access password. What is it for a default Raspbian install?

W. H. Heydt
Posts: 10995
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: root password for Raspbian

Fri Aug 25, 2017 4:16 pm

Default for Raspbian is that root has no password. You use the 'pi' account instead gaining root privileges with 'sudo'. That said, you can give root a password fairly easily.

klricks
Posts: 6609
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: root password for Raspbian

Fri Aug 25, 2017 5:12 pm

You can set the root password but should not be necessary.

Code: Select all

sudo passwd root
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

gkaiseril
Posts: 654
Joined: Mon Aug 08, 2016 9:27 pm
Location: Chicago, IL

Re: root password for Raspbian

Fri Aug 25, 2017 7:54 pm

The RPF deliberately made the decision to not assign a password to the root user for security reasons. It is well known that access to the root user provides full access to everything and section of the OS. By not assigning a password to the root user means any attacker or hacker to the system needs to find a valid user name and then attack the password for that user. This makes hacking the PI much harder. The hacker also needs to use a user name that has super user rights, another wall to breach. One can run a number of commands as the super user by use the sudo command to become the root user. Check the manual on the sudo command:

man sudo

If you assign a password to the root user you should then remove the password, but this is not task for a noob.
f u cn rd ths, u cn gt a gd jb n cmptr prgrmmng.

mikeyw64
Posts: 20
Joined: Fri Sep 13, 2019 9:55 am

Re: root password for Raspbian

Mon Sep 16, 2019 9:57 pm

really root is set to have no password even though it is an account that in theory can login ?

So glad I changed mine from force of habit when I set Raspbian up for the first time!!


[email protected]:~ $ sudo cat /etc/passwd | grep root
root:x:0:0:root:/root:/bin/bash

trejan
Posts: 730
Joined: Tue Jul 02, 2019 2:28 pm

Re: root password for Raspbian

Mon Sep 16, 2019 10:04 pm

mikeyw64 wrote:
Mon Sep 16, 2019 9:57 pm
really root is set to have no password even though it is an account that in theory can login ?
No. The default is that it forbids all login attempts. It isn't a blank password which would let anybody log in without a password. Once you've manually set a password then you can log into the root account.

mikeyw64
Posts: 20
Joined: Fri Sep 13, 2019 9:55 am

Re: root password for Raspbian

Mon Sep 16, 2019 10:14 pm

trejan wrote:
Mon Sep 16, 2019 10:04 pm
mikeyw64 wrote:
Mon Sep 16, 2019 9:57 pm
really root is set to have no password even though it is an account that in theory can login ?
No. The default is that it forbids all login attempts. It isn't a blank password which would let anybody log in without a password. Once you've manually set a password then you can log into the root account.
maybe the earlier answer that "The RPF deliberately made the decision to not assign a password to the root user" could have been better phrased then

eg

"The RPF deliberately made the decision not to allow login from the root user by disabling login via /etc/shadow"

;o)

Heater
Posts: 13617
Joined: Tue Jul 17, 2012 3:02 pm

Re: root password for Raspbian

Mon Sep 16, 2019 10:18 pm

You don't need a root password.

Just long in as Pi or whatever other user you have set up, then:

Code: Select all

$ sudo su
[email protected]:/home/pi# whoami
root
[email protected]:/home/pi#
Bingo! You are logged in as root.

Mostly for one off commands using "sudo" for the command in the TUI is sufficient.
Memory in C++ is a leaky abstraction .

Return to “General discussion”