3D Printer: What to Do When OctoPrint Password Is Forgotten?

You may have forgotten the password you used in the OctoPrint installation, or you may notice that your OctoPrint password is not working for no reason, like a similar incident that happened to us.

In such a case, there are a few fairly simple steps to follow:

You must perform all of these operations via command line/terminal or putty.

First, you need to connect to the computer where OctoPrint is installed via SSH and enter it into your root or authorized user account. If you have not made any subsequent changes, the default login information for the Raspberry Pi is: username: "pi" and its password is "raspberry". Note that this login information is separate from OctoPrint.

OctoPrint Version 1.3.12+ Users

  • Connect to the computer with SSH once OctoPrint is installed.
  • Start the virtual environment in OctoPrint: source ~/oprint/bin/activate
  • In the Run octoprint <user></user> user password command in the <user></user> terminal, type the user name you want to change the password for example: the test will be the octoprint user password test that you must type to change the password of an account with a user name.
  • After typing the password change command, you will see a line asking you to type the new password, where you can type the password you want and continue.
  • For your change to take effect, you need to restart the octoprint, just type a sudo service octoprint restart or similar command into the terminal to restart it.

OctoPrint Version 1.3.12 Users

If Only One User Account Exists

If you have a single user setup in Octoprint where you forgot the password, the easiest way is to reset the octoprint's user database and run the setup wizard again. In the same way, you must connect directly to the destination computer, or you must be using the computer that is installed octoprint in the meantime.

With Sudo, get the necessary permissions and run the following commands:

  • remove ~/.octoprint/users.yaml or rm remove ~/.octoprint/users.yaml
  • In the ~/.octoprint/config.yaml document, change the firstRun: false part to firstRun: true.
  • For your change to take effect, you need to restart the octoprint, just type a sudo service octoprint restart or similar command into the terminal to restart it.

If There Is More Than One User Account

If you have multiple configured users that you don't want to lose, you have two options:

  • If you have another OctoPrint user with administrator rights, you can reset your password through "Settings" > "Access Control" ("Settings" > "Access Control").

If you are the only administrator user, do the following:

First, back up the following file: users.yaml

  • cp ~/.octoprint/users.yaml ~/.octoprint/users.yaml.bck
  • Run the Setup wizard again as described above
  • Open the newly created users.yaml file in a text editor – there will only be one entry, so your new administrator account will copy all these lines.
  • Open the backed-up version of users.yaml in a text editor. Find your user account and replace all the lines with the lines you copied from the newly created users.
  • Delete the newly created users.yaml file and put it in the user.yaml location where you are modifying the users.yaml file on which you are modifying: mv ~/.octoprint/users.yaml.bck ~/.octoprint.users.yaml
  • For your change to take effect, you need to restart the octoprint, just type a sudo service octoprint restart or similar command into the terminal to restart it.

If You're Using OctoPi Instead of OctoPrint

We installed OctoPi on orange pi PC because we had problems installing OctoPrint. If you are one of the OctoPi installers, you can reset the password with these simple commands:

rm ~/.octoprint/users.yaml
sed -i -e 's/firstRun: false/firstRun: true/g' ~/.octoprint/config.yaml
sudo service octoprint restart

If the OctoPrint server is installed in Windows, the location of the files will be as follows:

%APPDATA%OctoPrintusers.yaml and %APPDATA%OctoPrintconfig.yaml

If installed on macOS, the locations will be as follows:

~/Library/Application Support/OctoPrint/users.yaml and ~/Library/Application Support/OctoPrint/config.yaml