Help. Forgotten root password
GavinWraith (26) 1563 posts |
I installed Raspbian on an SD card in my Rpi2 last year. I created a user for myself and I must have changed the root password. Now that I have an Rpi3 I updated Raspbian to the latest, but realize that I have forgotten the root password, or wrote it down on a piece of paper now lost. Is there any way of finding it out, short of re-installing a fresh copy of Raspbian onto the SD card? I am definitely not fond of the commandline. Editors like vi fill me with horror – StrongED is more my cup of tea – but modifications to config.txt evidentally need superuser status. Naive question: is there an easy way of being able to use a GUI as superuser – a sort of graphical equivalent of sudo? |
Chris Gransden (337) 1207 posts |
If you can log in as a normal user and sudo works you could try, sudo su - Then change the password with passwd. |
Mike Carter (36) 51 posts |
You can launch graphical applications as super user from the terminal, just type something like leafpad or pluma etc. after the sudo. If you’re not a fan of vi give nano a go. |
Steffen Huber (91) 1953 posts |
vi – either you love it or you hate it. I hate it, the one thing to remember about vi is to type Escape : q ! to exit with the file unchanged, and then start a proper editor like joe which has the well-known WordStar compatible keyboard shortcuts we all learned to love when starting our programming career with Turbo Pascal 3.0. |
Frank de Bruijn (160) 228 posts |
Do NOT run graphical applications with sudo (without -H) unless you are absolutely sure the application in question doesn’t write to your home directory! http://superuser.com/questions/202676/sudo-vs-gksudo-difference (second answer) Does Raspbian have gksudo? You could try ‘gksudo leafpad’ to open an editor as root. |
GavinWraith (26) 1563 posts |
Thanks for all the advice. Problem now sorted. I was trying to edit /boot/config.txt and in the end I found it easiest to take out the micro-SD card, put it in a card reader and edit it in Windows.
Thanks; you anticipated my next question. One of the Raspbian accessories is an application to edit the main menu. You can insert new entries by giving a label and a command. But I need to learn what commands are allowed. I downloaded SciTE, a text editor, and putting “SciTE” as the command, I made a new menu-item for it (but it did not show the SciTE icon, just a cog-wheel, though when a SciTE window is iconized to the taskbar the SciTE icon is shown — so how do I …. ?) which worked fine. Then I changed the command to “sudo SciTE”, but that only did the same thing as the command without the sudo. I realize that I need to understand a bit more about what actually happens when a command is entered, and how the GUI works. Obviously only one person can be interacting with the screen at a time – or am I wrong there? If I am wrong how does the software reacting to screen input know with whom it is dealing? A multi-user system obviously has to keep one user’s processes secure from those of other users. But that does not mean that a single-user system is necessarily insecure. One’s worst enemy is oneself, I suppose. I will investigate this gksudo. |
Frank de Bruijn (160) 228 posts |
How did you download it? Using the package manager or directly? I assume the latter, because the package contains a file (.desktop extension) to make the menu show an entry for the editor, including its icon.
It may have done more than you think. If you saved any settings while you ran it like that, it may have made them inaccessible to your ‘normal’ user. That’s one of the problems running GUI apps with sudo can cause (did you read the SuperUser thread I linked to?).
Because that would be the user who started the application catching that particular piece of input? A typical example would be starting SciTE as your user and (properly, i.e. with gksudo) as root. Settings changed in those two should end up in different home directories, even if you make those changes on the same screen, in two windows next to each other. |
Krzysztof Staniorowski (2787) 35 posts |
Nano, the only sane GUI-less editor. I’m pretty sure that vi was designed to arouse hate… |