パスワードを復元して管理者ユーザー権限を回復する

Confluence に管理者としてログインできない場合(たとえば、管理者パスワードを失った場合など)、以下の手順によって管理者ユーザー権限を回復できます。 

次の場合、この手順は有効ではありません。

  • Confluence is configured for SSO through Crowd.
    These instructions cover how to recover administration rights from the local 'Confluence Internal Directory' only. You won't be able to authenticate as a local Confluence administrator while Crowd SSO is enabled. See Integrating Crowd with Atlassian Confluence for info on how to configure or disable Crowd SSO.
  • You're using Confluence 3.4 or earlier.
    Please refer to the older documentation if you're still using OSUser or AtlassianUser.

On this page:

作業を開始する前に

The following instructions include example SQL that should work on MySQL and PostgreSQL. You may need to customise the queries for other databases or for your installation.

本番用データベースを変更する前にテスト用データベース上でクエリをテストすることを 強く お勧めします。

メールアドレスが有効な管理者ユーザー名がわかっていて、送信メールを設定している場合、以下の方法を使用する代わりに、パスワードを忘れた場合のリンクを使用して、パスワードをリセットできます。

パスワードのリセットに使用する管理者メールアカウントにリンクをお送りします。

データベースへのアクセス 

If you're using the embedded H2 database, you can find the files containing your database in <confluence-home-directory>/database. See Embedded H2 Database for information on how to connect.

外部の本番用データベースを使用している場合は、通常のツールを使用してデータベースに接続します。データベース内のクエリを実行し、データを更新する権限を持っている必要があります。

ステップ 1.管理者の特定

管理者権限を持つユーザー名を調べるには、DBVisualiser などのデータベース管理ツールを使用して、データベースに接続します。まだデータベース管理ツールをインストールしていない場合は、ここでダウンロードします。次に、データベースに接続して、管理者のユーザ名と ID 一覧を、次のコードで取得します。

select u.id, u.user_name, u.active from cwd_user u
join cwd_membership m on u.id=m.child_user_id join cwd_group g on m.parent_id=g.id join cwd_directory d on d.id=g.directory_id
where g.group_name = 'confluence-administrators' and d.directory_name='Confluence Internal Directory';

結果が複数である場合は、次の手順に使用する ID とユーザー名の組み合わせを 1 つ選択します。
結果がゼロである場合は、ローカル管理者が存在しない場合 の項目に移動します。

 

"アクティブ" フィールドに "T" の値が含まれているのを確認することが重要です。このフラグがない場合、このユーザーで認証しようとしても、成功の見込みはありません。

アクティブを true に設定するには、次のクエリの "<user_name>" を前のクエリのユーザー名で置き換えて実行します。

UPDATE cwd_user
SET active = 'T'
WHERE user_name ='<user_name>';

ローカル管理者が存在しない場合

内部ディレクトリに管理者が存在しない場合があります。このような場合は、管理者を追加する必要があります。

  1. 次を実行して、新しい管理者ユーザーを追加します。

    insert into cwd_user(id, user_name, lower_user_name, active, created_date, updated_date, first_name, lower_first_name, last_name, lower_last_name, display_name, lower_display_name, email_address, lower_email_address, directory_id, credential) values (1212121, 'admin', 'admin', 'T', '2009-11-26 17:42:08', '2009-11-26 17:42:08', 'A. D.', 'a. d.', 'Ministrator', 'ministrator', 'A. D. Ministrator', 'a. d. ministrator', 'admin@example.com', 'admin@example.com', (select id from cwd_directory where directory_name='Confluence Internal Directory'), 'x61Ey612Kl2gpFL56FT9weDnpSo4AV8j8+qx2AuTHdRyY036xxzTTrw10Wq3+4qQyB+XURPWx1ONxp3Y3pB37A==');
    
    
    insert into user_mapping values ('2c9681954172cf560000000000000001', 'admin', 'admin');
  2. 次を実行して、新しいグループを追加します。

    insert into cwd_group(id, group_name, lower_group_name, active, local, created_date, updated_date, description, group_type, directory_id)
    values ( '888888','confluence-administrators','confluence-administrators','T','F','2011-03-21 12:20:29','2011-03-21 12:20:29',NULL,'GROUP',(select id from cwd_directory where directory_name='Confluence Internal Directory'));
    insert into cwd_group(id, group_name, lower_group_name, active, local, created_date, updated_date, description, group_type, directory_id)
    values ( '999999','confluence-users','confluence-users','T','F','2011-03-21 12:20:29','2011-03-21 12:20:29',NULL,'GROUP',(select id from cwd_directory where directory_name='Confluence Internal Directory'));
    
  3. cwd_membership にグループ メンバーシップを追加します。

    insert into cwd_membership (id, parent_id, child_user_id) values (888888, (select id from cwd_group where group_name='confluence-users' and directory_id=(select id from cwd_directory where directory_name='Confluence Internal Directory')), 1212121);
    insert into cwd_membership (id, parent_id, child_user_id) values (999999, (select id from cwd_group where group_name='confluence-administrators' and directory_id=(select id from cwd_directory where directory_name='Confluence Internal Directory')), 1212121);
    

If you're using an Oracle database, use sysdate instead of a string for the created_date column.

ステップ 2.管理者パスワードの交換

Confluence doesn't store passwords in plain text in the database, but uses hashes computed from the original password. You'll need to insert a hash, rather than the plain password, over the existing password in the database. Below is the hash for the password admin

x61Ey612Kl2gpFL56FT9weDnpSo4AV8j8+qx2AuTHdRyY036xxzTTrw10Wq3+4qQyB+XURPWx1ONxp3Y3pB37A==

To change the password to admin for a given username:

  1. Confluence をシャットダウンします。
  2. データベースに接続します
  3. 次の SQL を実行します。

    update cwd_user set credential =
    'x61Ey612Kl2gpFL56FT9weDnpSo4AV8j8+qx2AuTHdRyY036xxzTTrw10Wq3+4qQyB+XURPWx1ONxp3Y3pB37A=='
    where id=<id from Stage 1>;

ステップ 3.先頭位置への内部ディレクトリ配置

Confluence を起動し、作成または更新したユーザーのユーザー名とパスワード「admin」を使用してログインします。これで動作する場合は、ステップ4 に進みます。動作しない場合は、内部ディレクトリに十分な高い優先順位が設定されていません。

内部ディレクトリを先頭位置に配置するには、

  1. ディレクトリ名とその順序を検索します。

    select d.id, d.directory_name, m.list_index from cwd_directory d join cwd_app_dir_mapping m on d.id=m.directory_id;
    
  2. list_index 0 に該当する ID と list_index、Confluence 内部ディレクトリの ID をメモします。
  3. ディレクトリの順序を入れ替えます。

    update cwd_app_dir_mapping set list_index = 0 where directory_id = <Internal Directory id>;
    update cwd_app_dir_mapping set list_index = <Noted Internal Directory list_index> where directory_id = <Directory id that had list_index 0>;
    
  4. ディレクトリがアクティブであるかどうかを確認します(「アクティブ」カラムが「T」に設定されている必要があります)。

    select id, directory_name, active from cwd_directory where id = <Internal Directory id>;
    
  5. 必要に応じて、ディレクトリをアクティブ化します。

    update cwd_directory set active = 'T' where id = <Internal Directory id>;
    

ステップ 4.クリーンアップ

整理するには、

  1. Confluence を起動します。
  2. Log in with your modified/created username and use password admin
  3. パスワードの変更

    パスワードを admin のままにしないでください。そのままで放置した場合、インスタンスは安全ではありません。

  4. ステージ 2 で新しいユーザーを作成した場合、UI 経由で新しい管理者を作成し、ステージ 2 で作成した管理者を削除します。
  5. If you followed Stage Three, go to  > General Configuration > User Directories and rearrange your directories so they're correctly configured again.
最終更新日: 2015 年 12 月 2 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.