User avatar
liudr
Posts: 702
Joined: Sat Jun 01, 2013 12:11 am
Location: Central MN, USA

root password

Thu Jun 27, 2013 3:30 am

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

User avatar
rpdom
Posts: 22351
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: root password

Thu Jun 27, 2013 5:06 am

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.

User avatar
solar3000
Posts: 1087
Joined: Sat May 18, 2013 12:14 am

Re: root password

Thu Jun 27, 2013 1:09 pm

sudo passwd root
Antikythera

yesyayen
Posts: 5
Joined: Sun Jun 23, 2013 10:18 am

Re: root password

Fri Jun 28, 2013 10:45 am

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

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: root password

Fri Jun 28, 2013 11:08 am

Or alternative sudo su can get you logged into root without the use of a password.:)

Richard S.

User avatar
rpdom
Posts: 22351
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: root password

Fri Jun 28, 2013 4:04 pm

redhawk wrote:Or alternative sudo su can get you logged into root without the use of a password.:)

Richard S.
Yep, that's pretty much the same as what "sudo -i" does :)

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: root password

Fri Jun 28, 2013 4:07 pm

Yep, that's pretty much the same as what "sudo -i" does...
Or "sudo bash" or "sudo csh" or "sudo rc" or ...

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)

User avatar
liudr
Posts: 702
Joined: Sat Jun 01, 2013 12:11 am
Location: Central MN, USA

Re: root password

Sun Jun 30, 2013 2:10 am

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

technion
Posts: 238
Joined: Sun Dec 02, 2012 9:49 am

Re: root password

Sun Jun 30, 2013 6:33 am

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.

itimpi
Posts: 1090
Joined: Sun Sep 25, 2011 11:44 am
Location: Potters Bar, United Kingdom

Re: root password

Sun Jun 30, 2013 7:23 am

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.

User avatar
liudr
Posts: 702
Joined: Sat Jun 01, 2013 12:11 am
Location: Central MN, USA

Re: root password

Sun Jun 30, 2013 2:44 pm

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

Kloktek
Posts: 1
Joined: Mon Jun 02, 2014 11:57 am

Re: root password

Wed Jul 16, 2014 4:25 pm

To access root account try one of these three commands.
Sudo su
Sudo passwd root
Sudowhoami

weeowey
Posts: 3
Joined: Sun Nov 02, 2014 6:18 pm
Location: Northern Ireland, UK

Re: root password

Mon Nov 03, 2014 10:27 pm

(In a terminal window or prompt, type:

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
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 ;)
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 ;)

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: root password

Tue Nov 04, 2014 1:36 pm

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
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

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: root password

Tue Nov 04, 2014 1:40 pm

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.
That is debatable and is a statement I do not agree with.
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

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: root password

Tue Nov 04, 2014 2:02 pm

Richard-TX wrote:
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.
That is debatable and is a statement I do not agree with.
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.

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)

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: root password

Tue Nov 04, 2014 6:23 pm

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

User avatar
DougieLawson
Posts: 42635
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: root password

Thu Nov 06, 2014 2:35 pm

Richard-TX wrote:Bash is a problem so I deal with it by removing it from the system. If thine eye offends thee....
Anyone who chooses to use the Korn shell has to be a bit "East Ham"[1] in my book.








[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.

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: root password

Thu Nov 06, 2014 3:03 pm

(Liked the "East Ham" reference)

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.
HTH, HAND.
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)

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK

Re: root password

Thu Nov 06, 2014 3:38 pm

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.
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: root password

Thu Nov 06, 2014 3:51 pm

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.....
Yes, I've stated this several times previously. It can't possibly be more "secure" by any sensible definition of that term.

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)

Tball2
Posts: 1
Joined: Wed Jan 20, 2016 1:52 am

Re: root password

Wed Jan 20, 2016 1:54 am

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

User avatar
nl3prc
Posts: 176
Joined: Sun Jul 24, 2016 12:39 pm
Location: Den Helder the netherlands

Re: root password

Sun Aug 07, 2016 1:03 pm

just go to /etc/ssh/sshd_config change the line as below
PermitRootLogin yes

mfa298
Posts: 1386
Joined: Tue Apr 22, 2014 11:18 am

Re: root password

Sun Aug 07, 2016 1:29 pm

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
nl3prc wrote:just go to /etc/ssh/sshd_config change the line as below
PermitRootLogin yes
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.

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 - "
this will tar up the contents of etc-pi on the local system and stream it to stdout, the stdout is piped into an ssh session that runs extracts the tar stream as root on the pi. There's probably a couple of mistakes in there so test it carefully first.

djx21
Posts: 1
Joined: Wed Dec 27, 2017 7:51 pm

Re: root password solved!

Wed Dec 27, 2017 8:04 pm

:D If you give yourself root access by typing

Code: Select all

sudo visudo 
Then going down to # User privilege specification you can copy this

Code: Select all

root    ALL=(ALL:ALL) ALL
And change root to your username Ex. pi ALL=(ALL:ALL) ALL You can then save the document and clear the screen. After the document is saved type

Code: Select all

sudo passwd root
And choose the password you are willing to use for the root account. Finally log out of your account and log in as other. user name:root Password: the password you chose and voila your on the root account. :D

Return to “Beginners”