LoginSignup
3
2

More than 5 years have passed since last update.

Redmineの全アカウントのパスワードを強制変更

Last updated at Posted at 2013-09-19

adminアカウント、もしくはadmin相当のアカウントのパスワードを忘れてしまった場合、Redmineのサーバにログインできるなら、rails consoleを使ってリセットできます。

この方法はRedmine.jpにも記載があるので、今回は全部のアカウントのパスワードを強制的に変えてしまう方法を載せてみます。

こんな時に使ってます。主に管理者としての作業です…。

  • 本番DBのデータをダンプして検証環境にリストアし、各アカウントの権限チェックを行いたい場合。
# rails console production
Loading production environment (Rails x.x.x)
>> @users = User.all
>> for user in @users
>>   user.password = “……” #好きなパスワードにしちゃう
>>   user.auth_source_id = nil
>>   user.save!
>> end

ユーザによっては、LDAPやOpenIDの認証を使ってるケースもあるので、ローカルのパスワード変更に加え、auth_source_id をnilに指定すればOKです。

20151128 追記:

この方法でのパスワード変更ですが、確認した時点でRedmine3.x系では、パスワードが短すぎるとsave!の処理でエラーになります。

ActiveRecord::RecordInvalid: Validation failed: Password is too short (minimum is 8 characters)

8文字以上のパスワードを指定してください。

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2