コンソールから管理者アカウントを作成する

:bookmark: このガイドでは、セルフホスト型Discourseインストールで、コンソールを使用して管理者アカウントを作成する方法、または管理者権限を付与する方法について説明します。

:person_raising_hand: 必要なユーザーレベル: システム管理者
:warning: コンソールアクセスが必要です

コンソールから管理者権限を作成/付与したい、またはユーザーのパスワードをリセットしたいですか?素晴らしい、始めましょう!

このガイドでは、以下の内容を説明します。

  • コンソールへのアクセス
  • 管理者権限を持つ新規アカウントの作成
  • 既存のパスワードのリセット
  • 既存のアカウントへの管理者権限の付与
  • マルチサイト構成の手順

コンソールへのアクセス

SSHを使用してDiscourseサーバーに接続するか、Windowsの場合はPuttyを使用します。

ssh root@your.server.ip

your.server.ip をサーバーの実際のIPアドレスに置き換えてください。

Discourseディレクトリに切り替えます。

cd /var/discourse

Dockerコンテナに入ります。

./launcher enter app

管理者権限を持つ新規アカウントの作成

コンソール内で、次のコマンドを実行します。

rake admin:create

以下の入力を求められます。

  • Email(メールアドレス)
  • Password(パスワード)
  • Repeat password(パスワードの再入力)

サイトがサインアップ時にフルネームを要求する場合(full_name_requirementrequired_at_signupに設定されている場合)、Full name(フルネーム)の入力を求められることもあります。

メールアドレスに基づいてユーザー名を持つ新しいアカウントが作成されます。「Account created successfully with username {username}」(ユーザー名{username}でアカウントが正常に作成されました)と表示されます。管理者権限を付与するか尋ねられたら、Enterを押して確認します。

成功すると、「Your account now has Admin privileges!」(あなたのアカウントは管理者権限を持ちました!)と表示されます。

マルチサイトの手順

マルチサイト構成の場合は、以下を実行します。

RAILS_DB=my_site_db rake admin:create 

既存のアカウントのパスワードのリセット

パスワードをリセットするには、同じコマンドを実行します。

rake admin:create

既存のアカウントのメールアドレスを入力します。ユーザーが存在する場合、パスワードをリセットするかどうか尋ねられます。続行するにはEnterを押します。新しいパスワードを入力し、確認します。

成功すると、Account updated successfully!(アカウントは正常に更新されました!)と表示されます。

既存のアカウントへの管理者権限の付与

コンソールからこのコマンドを実行します。

rake admin:create

Email(メールアドレス)を尋ねられるので、既存のアカウントのメールアドレスを入力します。

次に、「User with this email already exists! Do you want to reset the password for this email? (Y/n)」(このメールアドレスのユーザーはすでに存在します!このメールアドレスのパスワードをリセットしますか?(Y/n))と尋ねられます。 \text{\textless}kbd\text{\textgreater}n\text{\textless}/kbd\text{\textgreater} を押し、次に \text{\textless}kbd\text{\textgreater}enter\text{\textless}/kbd\text{\textgreater} を押します。

次に、「Do you want to grant Admin privileges to this account? (Y/n)」(このアカウントに管理者権限を付与しますか?(Y/n))と尋ねられます。続行するには \text{\textless}kbd\text{\textgreater}enter\text{\textless}/kbd\text{\textgreater} を押します。

成功すると、Your account now has Admin privileges!(あなたのアカウントは管理者権限を持ちました!)と表示されます。

マルチサイト構成の手順

マルチサイト設定の場合、コマンドの前に RAILS_DB=multisite_name をプレフィックスとして付けます。ここで multisite_name は、マルチサイト構成の最上位の行に対応します。

設定例:

mysite:
  adapter: postgresql
  database: database2
  password: secret
  pool: 25
  host: data
  host_names:
    - mysite.example.com

コマンド:

RAILS_DB=mysite rake admin:create
「いいね!」 59
SOLVED: Unable to Grant Admin or Grant Moderator to existing users
System account login
How to install Discourse on windows
Cannot access /admin
Run Discourse without email?
Dummy user to create initial content
How to install Discourse without a mail server?
Problème de réception du mail de confirmation admin (installation sur Hostinger)
Not getting activation email
Remove the installation step Resend Activation Email discourse
Why is email verification required upfront?
Blank login and signup page
Reset lost admin password
I can't change my admin user email
FAQs on recurring topics
Getting stuck during bootstrap
Grant administrator rights to a user
Send admin account email to different email
Discourse as Your First Rails App
How to resend activate email when I close the tab
Developing Discourse Plugins - Part 1 - Create a basic plugin
Sidekiq shows activation emails being sent to email address nil
Emails to confirm new admin not being sent
Set up Discourse for development on Fedora Linux
Trying to install Discourse on Docker before server just testing software?
Installing Discourse using Portainer
Developing Discourse using a Dev Container
Update our admins and moderator shields
Can Discourse function without emails entirely?
Install Discourse for development using Docker
Grant admin confirmation mail not sent
Skipped Email - User does not exist
Require mail confirmation to grant admin privileges
Connecting to Droplet
So I can't login anymore :( and won't receive email logins or forgotten password emails
Generating mailing logs for console to check installation?
Adding a User Without Inviting Them
Admin confirmation link broken

Codespaceで :globe_with_meridians: をクリックし、4200と表示されたところ、管理者アカウントがないと表示されました。GitHub Codespaceでこれをどうすればよいですか?