从控制台创建管理员账户

: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

系统将提示您输入:

  • 电子邮件
  • 密码
  • 重复密码

如果您的站点要求在注册时提供全名(full_name_requirement 设置为 required_at_signup),系统还会提示您输入全名

将创建一个新帐户,其用户名基于电子邮件地址。您将看到:“Account created successfully with 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

系统将询问电子邮件,输入现有帐户的电子邮件。

现在系统将询问:“User with this email already exists! Do you want to reset the password for this email? (Y/n)”。按 n 然后按 enter

现在系统将询问:“Do you want to grant Admin privileges to this account? (Y/n)”。按 enter 继续。

如果成功,您将看到 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