root password
This is extremely noob question. I don't remember I was given a chance to set root password when I was setting up my Raspbian from downloaded image. I tried my pi account password and it didn't work. How do I get access to root account?
Arduino data loggers, user interface, printed circuit board designer since 2009, RPI 3B 2B 2B Zero Jessie, assembly/C/C++/java/python programmer since the 80's
Re: root password
The root password is disabled.
Use sudo as the pi user to run commands as root.
If you really want to become root for any length of time, use sudo -i, then exit (or Ctrl-D) to go back to the pi account.
Use sudo as the pi user to run commands as root.
If you really want to become root for any length of time, use sudo -i, then exit (or Ctrl-D) to go back to the pi account.
Re: root password
boot into runlevel 1 and you will get terminal with root access.
There you can change root's password
$ sudo init 1
//after booting into runlevel 1
$ passwd
There you can change root's password
$ sudo init 1
//after booting into runlevel 1
$ passwd
Re: root password
Or alternative sudo su can get you logged into root without the use of a password.
Richard S.

Richard S.
Re: root password
Yep, that's pretty much the same as what "sudo -i" doesredhawk wrote:Or alternative sudo su can get you logged into root without the use of a password.
Richard S.

-
- Posts: 4277
- Joined: Sun Jan 15, 2012 1:11 pm
Re: root password
Or "sudo bash" or "sudo csh" or "sudo rc" or ...Yep, that's pretty much the same as what "sudo -i" does...
I.e., I think the point he was making was that you don't need to go into single user mode, as long as you can sudo (from the regular runlevel)
And some folks need to stop being fanboys and see the forest behind the trees.
(One of the best lines I've seen on this board lately)
(One of the best lines I've seen on this board lately)
Re: root password
Great! Many thanks! I got a root terminal with sudo su. So if root has no password, then is the RPI vulnerable to attacks?!
Arduino data loggers, user interface, printed circuit board designer since 2009, RPI 3B 2B 2B Zero Jessie, assembly/C/C++/java/python programmer since the 80's
Re: root password
Nope. The root user password is not "empty", it's "disabled". The difference being that the root user can't be directly logged on unless you decide to give it a password. This is a more secure configuration than allowing direct logon as root.
Re: root password
Probably the greatest security risk is that all Pi's start with the same username/password combination of pi/raspberry and many users probably do not reset the password to be something not generally unknown.
Re: root password
Thanks. Now everything makes sense. I'll just leave the root the way it was set up.
Arduino data loggers, user interface, printed circuit board designer since 2009, RPI 3B 2B 2B Zero Jessie, assembly/C/C++/java/python programmer since the 80's
Re: root password
To access root account try one of these three commands.
Sudo su
Sudo passwd root
Sudowhoami
Sudo su
Sudo passwd root
Sudowhoami
Re: root password
(In a terminal window or prompt, type:
This lets you login as the 'Root' user on most or all Linux 'Distros'.
If you want to 'fully login' as root, like getting access to the "SYSTEM" account on windows, type in this in any terminal prompt or window:
This will start the X Window System (aka X11) GUI(s) and will allow you to pretty much do anything without having to type in a password! You can even delete critical system files, SO BE CAREFUL!!!!
'Nuff said,
Hope this helps anyone in the near, past or distant future!
I'm new to Raspberry Pi, but i'm not new to linux! [Insert Linux Opensource ftw stuff here] and maybe leave feedback if you can
Code: Select all
sudo su
This lets you login as the 'Root' user on most or all Linux 'Distros'.
If you want to 'fully login' as root, like getting access to the "SYSTEM" account on windows, type in this in any terminal prompt or window:
Code: Select all
sudo su
startx
'Nuff said,
Hope this helps anyone in the near, past or distant future!
I'm new to Raspberry Pi, but i'm not new to linux! [Insert Linux Opensource ftw stuff here] and maybe leave feedback if you can

I'm new to Raspberry Pi, but i'm not new to linux! [Insert Linux Opensource ftw stuff here] and maybe leave feedback if you can 

- Richard-TX
- Posts: 1549
- Joined: Tue May 28, 2013 3:24 pm
- Location: North Texas
Re: root password
The first things I do when I bring up a new RpI is:
- assign a root passwd
- disable the pi account (passwd -l pi)
- add my own account
- install ksh
-edit /etc/passwd so that all shells are ksh, not bash
- rename bash to bash.old
- link dash to bash
- chmod 0000 bash.old
- assign a root passwd
- disable the pi account (passwd -l pi)
- add my own account
- install ksh
-edit /etc/passwd so that all shells are ksh, not bash
- rename bash to bash.old
- link dash to bash
- chmod 0000 bash.old
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip
- Richard-TX
- Posts: 1549
- Joined: Tue May 28, 2013 3:24 pm
- Location: North Texas
Re: root password
That is debatable and is a statement I do not agree with.technion wrote:Nope. The root user password is not "empty", it's "disabled". The difference being that the root user can't be directly logged on unless you decide to give it a password. This is a more secure configuration than allowing direct logon as root.
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip
-
- Posts: 4277
- Joined: Sun Jan 15, 2012 1:11 pm
Re: root password
Indeed. There is a tendency on forums in general and this forum in particular, to give out the canonical answer to these sorts of questions (generally, security-oriented) even though those canonical answers are often (as in this case) nonsense. It's as if people believe that something bad will happen to them if they don't give out the canonical answer.Richard-TX wrote:That is debatable and is a statement I do not agree with.technion wrote:Nope. The root user password is not "empty", it's "disabled". The difference being that the root user can't be directly logged on unless you decide to give it a password. This is a more secure configuration than allowing direct logon as root.
BTW, I gather from your last post that you really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really don't like bash. Is that correct?
In fact, it could be said that you really, really, really, really, really like to bash bash.
And some folks need to stop being fanboys and see the forest behind the trees.
(One of the best lines I've seen on this board lately)
(One of the best lines I've seen on this board lately)
- Richard-TX
- Posts: 1549
- Joined: Tue May 28, 2013 3:24 pm
- Location: North Texas
Re: root password
Bash is a problem so I deal with it by removing it from the system. If thine eye offends thee....
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip
- DougieLawson
- Posts: 42635
- Joined: Sun Jun 16, 2013 11:19 pm
- Location: A small cave in deepest darkest Basingstoke, UK
Re: root password
Anyone who chooses to use the Korn shell has to be a bit "East Ham"[1] in my book.Richard-TX wrote:Bash is a problem so I deal with it by removing it from the system. If thine eye offends thee....
[1] http://www.urbandictionary.com/define.php?term=East+Ham
Languages using left-hand whitespace for syntax are ridiculous
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.
DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.
The use of crystal balls and mind reading is prohibited.
-
- Posts: 4277
- Joined: Sun Jan 15, 2012 1:11 pm
Re: root password
(Liked the "East Ham" reference)
When it comes to talking about shells, I think there are two things driving the anti-bash sentiment:
When it comes to talking about shells, I think there are two things driving the anti-bash sentiment:
- 1) When ksh came out, it was such a vast improvement over it's predecessor (plain old, unusable-for-interactive-use sh), that it inspired a devoted following. Even though it is clunky and kludgey compared to modern shells (tcsh & bash), there are some people who swear by it (such as Richard-Tx) simply because it was such an improvement over what existed prior.
2) The recent spate of "bash bugs" (shellshock, etc), which suggests that bash is too csh-like (that is, actually usable by normal people) to be considered acceptable by the elites.
And some folks need to stop being fanboys and see the forest behind the trees.
(One of the best lines I've seen on this board lately)
(One of the best lines I've seen on this board lately)
Re: root password
Personally, I fail to see how giving root access without a password to an ordinary user (pi) as with the default setup is more secure than having a password on root.....
The default Ubuntu configuration makes more sense, where the users password has to be entered again to gain access to sudo. Stops somebody hijacking a machine that's been left logged on unattended.
The default Ubuntu configuration makes more sense, where the users password has to be entered again to gain access to sudo. Stops somebody hijacking a machine that's been left logged on unattended.
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......
I must not tread on too many sacred cows......
-
- Posts: 4277
- Joined: Sun Jan 15, 2012 1:11 pm
Re: root password
Yes, I've stated this several times previously. It can't possibly be more "secure" by any sensible definition of that term.Personally, I fail to see how giving root access without a password to an ordinary user (pi) as with the default setup is more secure than having a password on root.....
I think the current (weird IMHO) situation in Raspian is driven by some or all of the following:
- 1) Wanting it to be easy for the newbie user (as few barriers as possible). Basically, get them in the habit of preceding every (system-y) command with the magic 4 letters s, u, d, and u, and then things will just work.
2) Wanting it to be compatible with upstream Debian/Ubuntu, which has, like it or not, drunk the sudo KoolAid. (Incidentally, ditto this comment for Jessie/systemd, which is going to be another disaster for the Pi support staff [that's us!])
3) Wanting it to be as difficult as possible to run GUI apps as root (for "security" reasons).
And some folks need to stop being fanboys and see the forest behind the trees.
(One of the best lines I've seen on this board lately)
(One of the best lines I've seen on this board lately)
Re: root password
Hey guys. How do i SSH into a root account. I want to be able to transfer files into /etc/ but I cannot because you need root to do so. Any help is appreciated. Thanks
Re: root password
just go to /etc/ssh/sshd_config change the line as below
PermitRootLogin yes
PermitRootLogin yes
Re: root password
Tball2 wrote:Hey guys. How do i SSH into a root account. I want to be able to transfer files into /etc/ but I cannot because you need root to do so. Any help is appreciated. Thanks
The better option is to stick an ssh key into /root/.ssh/authorized_keys and set the PermitRootLogin setting to without-password. This means you can only log in externally as root with a valid ssh key. For added security you can specify in /root/.ssh/authorized_keys where the key can be used from and what commands it can run.nl3prc wrote:just go to /etc/ssh/sshd_config change the line as below
PermitRootLogin yes
An alternate option could be done with ssh rather than scp and doesn't need a root login, e.g. something like (not tested)
Code: Select all
tar cf - etc-pi | ssh pi@raspberrypi "sudo tar -C /etc -xf - "
Re: root password solved!

Code: Select all
sudo visudo
Code: Select all
root ALL=(ALL:ALL) ALL
Code: Select all
sudo passwd root
