Skip to content

配置自托管的 n8n 用户管理#

¥Configure self-hosted n8n for user management

n8n 中的用户管理功能允许你邀请他人加入你的 n8n 实例。

¥User management in n8n allows you to invite people to work in your n8n instance.

本文档描述了如何配置 n8n 实例以支持用户管理,以及开始邀请用户的步骤。

¥This document describes how to configure your n8n instance to support user management, and the steps to start inviting users.

请参阅主 用户管理 指南,了解更多使用信息,包括:

¥Refer to the main User management guide for more information about usage, including:

¥Managing users

¥Account types

¥Best practices

有关 LDAP 设置信息,请参阅 LDAP

¥For LDAP setup information, refer to LDAP.

有关 SAML 设置信息,请参阅 SAML

¥For SAML setup information, refer to SAML.

Basic auth and JWT removed

n8n 在 1.0 版本中移除了对基本身份验证和 JWT 的支持。

¥n8n removed support for basic auth and JWT in version 1.0.

设置#

¥Setup

在 n8n 中设置用户管理分为三个阶段:

¥There are three stages to set up user management in n8n:

  1. 配置你的 n8n 实例以使用你的 SMTP 服务器。

¥Configure your n8n instance to use your SMTP server. 2. 启动 n8n 并按照应用中的设置步骤进行操作。

¥Start n8n and follow the setup steps in the app. 3. 邀请用户。

¥Invite users.

步骤 1:SMTP#

¥Step one: SMTP

n8n 建议你设置一个 SMTP 服务器,用于用户邀请和密码重置。

¥n8n recommends setting up an SMTP server, for user invites and password resets.

Optional from 0.210.1

从 0.210.1 版本开始,此步骤为可选步骤。你可以选择手动复制并发送邀请链接,而不是设置 SMTP。请注意,如果你跳过此步骤,用户将无法重置密码。

¥From version 0.210.1 onward, this step is optional. You can choose to manually copy and send invite links instead of setting up SMTP. Note that if you skip this step, users can't reset passwords.

从你的 SMTP 提供商获取以下信息:

¥Get the following information from your SMTP provider:

  • 服务器名称

¥Server name

  • SMTP 用户名

¥SMTP username

  • SMTP 密码

¥SMTP password

  • SMTP 发件人名称

¥SMTP sender name

要使用 n8n 设置 SMTP,请为你的 n8n 实例配置 SMTP 环境变量。有关如何设置环境变量的信息,请参阅 配置

¥To set up SMTP with n8n, configure the SMTP environment variables for your n8n instance. For information on how to set environment variables, refer to Configuration

变量 类型 描述 是否必填?
N8N_EMAIL_MODE string smtp 必需
N8N_SMTP_HOST string your_SMTP_server_name 必需
N8N_SMTP_PORT number your_SMTP_server_port 默认值为 465 可选
N8N_SMTP_USER string your_SMTP_username 可选
N8N_SMTP_PASS string your_SMTP_password 可选
N8N_SMTP_OAUTH_SERVICE_CLIENT string your_OAuth_service_client 可选
N8N_SMTP_OAUTH_PRIVATE_KEY string your_OAuth_private_key 可选
N8N_SMTP_SENDER string 发件人电子邮件地址你可以选择包含发送者名称。包含名称的示例:N8N <contact@n8n.com> 必需
N8N_SMTP_SSL boolean 是否对 SMTP 使用 SSL(启用)或不支持(禁用)。默认为 true 可选
N8N_UM_EMAIL_TEMPLATES_INVITE string HTML 电子邮件模板的完整路径。此选项会覆盖邀请电子邮件的默认模板。 可选
N8N_UM_EMAIL_TEMPLATES_PWRESET string HTML 电子邮件模板的完整路径。此操作会覆盖密码重置邮件的默认模板。 可选
N8N_UM_EMAIL_TEMPLATES_WORKFLOW_SHARED 字符串 覆盖用于通知用户已共享凭据的默认 HTML 模板。提供模板的完整路径。 可选
N8N_UM_EMAIL_TEMPLATES_CREDENTIALS_SHARED 字符串 覆盖用于通知用户已共享凭据的默认 HTML 模板。提供模板的完整路径。 可选
N8N_UM_EMAIL_TEMPLATES_PROJECT_SHARED 字符串 覆盖用于通知用户已共享项目的默认 HTML 模板。提供模板的完整路径。 可选

如果你的 n8n 实例已在运行,你需要重启它以启用新的 SMTP 设置。

¥If your n8n instance is already running, you need to restart it to enable the new SMTP settings.

More configuration options

还有更多配置选项可通过环境变量获得。有关列表,请参阅 环境变量。如果你不希望用户看到标签、工作流模板和个性化调查,可以使用这些选项禁用它们。

¥There are more configuration options available as environment variables. Refer to Environment variables for a list. These include options to disable tags, workflow templates, and the personalization survey, if you don't want your users to see them.

New to SMTP?

如果你不熟悉 SMTP,博客文章 SendGrid 提供了一个简短的介绍,而 维基百科简单邮件传输协议 (SMP) 条目 则提供了更详细的技术背景。

¥If you're not familiar with SMTP, this blog post by SendGrid offers a short introduction, while Wikipedia's Simple Mail Transfer Protocol article provides more detailed technical background.

步骤 2:应用内设置#

¥Step two: In-app setup

When you set up user management for the first time, you create an owner account.

  1. Open n8n. The app displays a signup screen.
  2. Enter your details. Your password must be at least eight characters, including at least one number and one capital letter.
  3. Click Next. n8n logs you in with your new owner account.

步骤 3:邀请用户#

¥Step three: Invite users

You can now invite other people to your n8n instance.

  1. Sign into your workspace with your owner account. (If you are in the Admin Panel open your Workspace from the Dashboard)
  2. Click the three dots next to your user icon at the bottom left and click Settings. n8n opens your Personal settings page.
  3. Click Users to go to the Users page.
  4. Click Invite.
  5. Enter the new user's email address.
  6. Click Invite user. n8n sends an email with a link for the new user to join.