Octoprint: Password reset

Created on 16 Sep 2015  路  9Comments  路  Source: OctoPrint/OctoPrint

It would be good to have the ability to reset a forgotten password.
Even a wiki entry on how to do it from the command line would cut it.

Helps avoid being completely locked out of the interface.. like I am right now. :)

incomplete

Most helpful comment

https://github.com/foosel/OctoPrint/wiki/Configuring-Access-Control

Near the bottom, it says to rerun the wizard, do the following:

  1. edit ~/.octoprint/config.yaml and set firstRun: true. It should be there already set to false in your case.
  2. remove ~/.octoprint/users.yaml

I would also: sudo service octoprint restart

All 9 comments

Hi @kareem613,

It looks like there is some information missing from your ticket that will be needed in order to process it properly. Please take a look at the Contribution Guidelines and the page How to file a bug report on the project wiki, which will tell you exactly what your ticket has to contain in order to be processable.

If you did not intend to report a bug, please take special note of the title format to use as described in the Contribution Guidelines.

I'm marking this one now as needing some more information. Please understand that if you do not provide that information within the next two weeks (until 2015-09-30 03:10) I'll close this ticket so it doesn't clutter the bug tracker. This is nothing personal, so please just be considerate and help the maintainers solve this problem quickly by following the guidelines linked above. Thank you!

Best regards,
~ Your friendly GitIssueBot

PS: I'm just an automated script, not a human being, so don't expect any replies from me :) Your ticket is read by humans too, I'm just not one of them.

https://github.com/foosel/OctoPrint/wiki/Configuring-Access-Control

Near the bottom, it says to rerun the wizard, do the following:

  1. edit ~/.octoprint/config.yaml and set firstRun: true. It should be there already set to false in your case.
  2. remove ~/.octoprint/users.yaml

I would also: sudo service octoprint restart

Perfect! Thanks. I guess this isn't a feature request then.

@kareem613 as the bot kindly told you, it wasn't marked as a feature request by you in any case ;)

If anyone is curious, there's a shortcut way to do it, so long as you have UI access. Simply go to settings -> server and change the "Restart System" command from sudo shutdown -r now to echo "pi:pi" | sudo chpasswd, then click -> "Reboot System" -> Proceed. Just make sure to change the restart command back when you're done. No telling how long this will work, as it's definitely a security issue and should probably be fixed.

That being possible is caused by passwordless sudo being allowed in Raspbian and hence OctoPi incl 0.14 by default, and that is addressed in guysoft/OctoPi#345

And after having read up on the ticket again, this is also not related to the login credentials discussed here ;)

Just forgot my password. Here is how I recovered WITHOUT RESETTING ALL CONFIGS.

SSH into the user running octoprint, then run

$ grep salt .octoprint/config.yaml

You wil get "salt: SomeString" as a response. Copy that string then run:

echo -n MyNewPasswordSomeString | sha512sum

You will get the octoprint-internal hashed password. Copy it, edit .octoprint/users.yaml and replace the password for the desired user.

Login on the web page using MyNewPassword as the password.

Creating a simple octoprint-passwd.py should be easy for someone who, unlike me, actually knows python.

Here is a one-liner pass reset, if you only have one user:

NEW_PASSWORD='my new password' ; sed "s/password:.*/password: $(printf '%s%s' ${NEW_PASSWORD} "$(grep salt .octoprint/config.yaml | awk -F ' ' '{print $NF}')" | sha512sum | awk -F ' ' '{print $1}')/" ~/.octoprint/users.yaml

Just change my new password by what you want.

Was this page helpful?
0 / 5 - 0 ratings