5

I installed openproject in CentOS 7 using docker. I changed the admin password and then I forgot it.

How can I reset it.?

2 Answers 2

9

For newer versions of OpenProject, Ulferts' solution seems not to work, but I was successfull using the information in this guide:

  1. Find out the container ID: docker ps.
  2. Connect to the docker container as root: docker exec -u root -it <CONTAINER ID> /bin/bash
  3. Change the users password with rails console:
    RAILS_ENV=production bundle exec rails c
    u = User.find_by_login "admin"
    u.password=u.password_confirmation='my new password'
    u.save
    
  4. (Hit Ctrl-D until you're back on your regular terminal.)
Sign up to request clarification or add additional context in comments.

1 Comment

If you have OpenProject installation in 6, do it in the container running 'web' service.
8

If the settings permit (which is the default), the easiest solution would be to go to the login page (https://[host]/login) of the OpenProject installation (via a browser) and use the "Forgot your password?" link to have a password reset token send to the email address configured for the admin account.

If that option does not exist, you have to connect to the docker container to get a terminal window on it, e.g. by following this how-to.

Once you have a bash open, issue:

sudo openproject run rails console

which will open a rails console for you.

Once inside, issue:

# retrieve first admin account
admin = User.where(admin: true).first
# change the password
admin.password = admin.password_confirmation = "[The password you choose]"
# Save the change disregarding any errors
admin.save(validate: false)

In case you have more than one admin account on the installation, you will have to narrow down the correct one in the first step by e.g.

# print a list of all admin accounts
pp User.where(admin: true).pluck(:id, :login, :firstname, :lastname, :mail)
# Fetch admin account by id
admin = User.where(id: "[the id]")

4 Comments

Hello, I'm trying to use your solution but I get errors: root@ee12ce60a11b:/app# sudo openproject run rails console bash: sudo: command not found root@ee12ce60a11b:/app# openproject run rails console bash: openproject: command not found ```
I'd assume that sudo ist not installed. You might fix the problem by connecting to the docker container as root: stackoverflow.com/a/49529946/3206935
I connected as root, but: /app# openproject run rails console results in bash: openproject: command not found
I used ` admin = User.where(admin: true, login: "admin" ).first ` to change the password of the specific admin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.