My Stoopid Stuff
  • Home
  • Projects
  • Blog
  • Lec'tronics
  • Links
  • CNC
  • Quick Recipes
  • 3D Printer Tips

Fixing lost passwords in OctoPi

12/12/2019

3 Comments

 
I just saw this thread on Thingiverse and learned how to reset the "pi" user password thanks to info from lar3ry who answered another users question on how to reset a password by pointing to a fix provided by Foosel (the creator and maintainer of Octoprint) which is here. 

There are actually two passwords that may need to be reset, and it is possible both will need to be reset.

The first password is the password for the pi itself.  In order to reset any passwords, the first step is to log into the pi using ssh.  To do that use a ssh client like putty.  Below is a pic of the screen you would see when launching putty.  You should not need to modify any of the options, just put the IP address of the Pi in the field and then click Open.  It will pop up a box asking you about saving the key (yes), and then the terminal window will open where you can log in to the Pi.
Picture
If you never updated your pi password, then it may still be "raspberry", so you can try try logging in using that (or any password you may have changed it to).   If your password is still "raspberry" though, it would be good to change that from the default using "sudo passwd pi", then enter the current password (raspberry), and then enter a new password (and then one more time).

If you do not recall the password, then it can be reset using the info here.

To summarize what is explained in that link, the process is to:

1. power off the pi, remove the MicroSD card, and put that in a PC.
2. Then in the drive called "boot", create a file named "octopi-password.txt"
3. In that text file ("octopi-password.txt") you only need the password you want to set for the "pi" user, nothing else.  So it will be one word only in this file. 
4. Now take the MicroSD out of the PC, install it in the pi and boot it. 
5. You can now log in again using SSH, with username "pi" and the password you set in the file "octopi-password.txt".

To reset the password used to access the Octoprint web server running on the Pi...


The second password that may need to be reset is the one most people use when they log into the octoprint webserver, and that is done using the method described here:

https://community.octoprint.org/t/octoprint-wont-recognize-log-in/2474/8

The long-winded explanation of that process is to log into the pi via ssh using username "pi" and password (as described above).  Then the following needs to be done:

1. Delete ~/.octoprint/users.yaml (you can view whats in there using more ~/.octoprint/users.yaml in case you just need to recall the username that was used):

rm ~/.octoprint/users.yaml

2. Edit ~/.octoprint/config.yaml using nano (which is already installed), and then find "firstrun" and replace "false" with "true".  This will cause the Octoprint server to produce the initial setup dialog (on the next restart). where the username and password can be entered again.  Be careful editing this file though, since spaces matter, all that is needed is to change the one word from false to true.  If you need to go back, just Ctrl+x, and to search for a word use Ctrl+w (then enter the word you are looking for).  When satisfied with the changes, just write the file use Ctrl+o and then Ctrl+x.

nano ~/.octoprint/config.yaml
Picture
3. Now just reboot and log back in using the browser.

sudo reboot

If you run TouchUI you may need to update one more thing...

If you change the username and use TouchUI (which is a touchscreen plugin for Octoprint), then there is one more step as explained here.

When TouchUI was initially set up, it asked for the username, which would allow it to autologin to the Octoprint server.  If the username was changed for whatever reason, it will no longer auto-login.  To fix that, the ~/.octoprint/config.yaml needs to be edited.  Specifically, look for "accessControl:" near the top, and then under that will be "autologinAs:" with a username.  So you guessed it, gotta change the username to match the new one.  Also check that "autologinLocal:" is "true".

Be careful editing this file though, since spaces matter, all that is needed is to change the username.  If you need to go back, just Ctrl+x, and to search for a word use Ctrl+w (then enter the word you are looking for).  When satisfied with the changes, just write the file use Ctrl+o and then Ctrl+x.

nano ~/.octoprint/config.yaml
Picture
Then just reboot the Pi, or restart the Octoprint and TouchUI services.  It should then autologin as before.
3 Comments
Aaron
8/15/2021 06:44:13 am

Hi I have a touch screen connected to my Pi 3, is this the same thing as the TouchUI? I tried this step:
When TouchUI was initially set up, it asked for the username, which would allow it to autologin to the Octoprint server. If the username was changed for whatever reason, it will no longer auto-login. To fix that, the ~/.octoprint/config.yaml needs to be edited.

What I got in return was this:
bash: /home/pi/.octoprint/config.yaml: Permission denied

Not sure what to do now? Can you help or elaborate?
Thank you in advance.

Reply
Mike link
8/15/2021 12:10:17 pm

Hi, TouchUI is a plugin for Octoprint which organizes the OctoPrint UI for a touchscreen (https://plugins.octoprint.org/plugins/touchui/). I believe that by now there are other plugins to do that aside from TouchUI, but TouchUI is the one I have tried.

One thing to check for the problem editing the config.yaml file, is that you are logged in as the "pi" user. Most people only have one user account set up on the Pi though, so that would be strange. You can check what username you are logged into the Pi as using "whoami", which will return your username. If you are not the "pi" user, then you can edit the ~/.octoprint/config.yaml by using "sudo":

sudo nano ~/.octoprint/config.yaml

Then it will ask you to enter the pi user password before you can edit the file.

Reply
Thomas De Leon
8/15/2021 03:42:29 pm

Hi Mike, thank you for the update. I will start it tomorrow evening.

Reply



Leave a Reply.

    Picture

    Stoopid Me

    Welcome to my Stoopid corner of teh Internet.  It's mostly gonna be 3D printing stuff, but I also post some recipes, projects, and the occasional rant here as well.  More Stoopid stuff is updated regularly.

    I recently joined the Amazon Associate program, so some of the links on this site are Amazon affiliate links. This means that, at zero cost to you, I will earn an affiliate commission if you click through the link and finalize a purchase.  This will help to support this site, and pay for more Stoopid Stuff.

    Archives

    March 2023
    February 2023
    January 2023
    November 2022
    October 2022
    September 2022
    August 2022
    July 2022
    April 2022
    February 2022
    January 2022
    December 2021
    November 2021
    October 2021
    September 2021
    August 2021
    July 2021
    June 2021
    May 2021
    April 2021
    March 2021
    February 2021
    January 2021
    December 2020
    November 2020
    October 2020
    September 2020
    August 2020
    July 2020
    June 2020
    May 2020
    April 2020
    March 2020
    February 2020
    January 2020
    December 2019
    November 2019
    October 2019
    September 2019
    August 2019
    July 2019
    June 2019
    May 2019
    April 2019
    March 2019
    February 2019
    January 2019
    December 2018
    November 2018
    October 2018
    September 2018
    August 2018
    July 2018
    June 2018
    May 2018
    April 2018
    March 2018
    February 2018
    November 2017
    September 2017
    August 2017
    June 2017
    December 2016
    October 2016
    September 2016
    July 2016
    March 2016
    February 2016
    September 2015
    August 2015
    June 2015
    May 2015
    April 2015
    March 2015
    February 2015
    January 2015
    December 2014
    November 2014
    October 2014
    September 2014
    July 2014
    June 2014
    May 2014
    April 2014
    March 2014
    February 2014
    November 2013
    August 2013
    July 2013
    June 2013
    May 2013
    April 2013
    March 2013
    January 2013
    December 2012
    November 2012
    October 2012
    September 2012
    August 2012

    Categories

    All

    RSS Feed

      Contact Form (Name is optional)

    Submit
Powered by Create your own unique website with customizable templates.