LoginSignup
2
1

More than 5 years have passed since last update.

Drupal 管理者パスワードが分からない時の対処法

Posted at
1 / 7

はじめに

この記事は、第3回 Drupal 勉強会@DC で飛び入りLTとして発表した内容です。
https://dgcircus.connpass.com/event/53225/
定期開催なので、興味がある方、お待ちしています。


今日のお話

シングルサインオンでログインできるDrupalサイトの場合、
Drupal直ログインのパスワードが忘れられているときが結構あります。
いつの間にかどのユーザでもログインできない!そんな時に直面した時の対処法です。


パスワードを変更する

Drushコマンドでパスワードを更新

$ drush user-password ユーザ名 --password="newpassword"


ワンタイムログインURLを発行する

DruahでURLを発行

$ drush user-login --uid=[uid] #The user id of the account
$ drush user-login --name=[name] # Name of the account
$ drush user-login --email=[email] # A user mail address to log in as

uid=1のユーザはDrupalインストール時にadministratorとして作成されています。
よくわからなければ、uid=1のユーザでログインするのがおすすめです。


DBの中身を書き換える

スクリプトでパスワード文字列生成
  • D7
    • $ scripts/password-hash.sh newpwd 'newpassword'
  • D8
    • $ php core/scripts/password-hash.sh 'newpassword'
DB内を書き換える
  • D7
    • usersテーブル passカラム
  • D8
    • users_field_dataテーブルのpassカラム

参考
https://www.drupal.org/node/44164

2
1
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
2
1