使用雙因素身份驗證

雙因素身份驗證 (2FA) 是一種保護您的 Nextcloud 帳號免受未經授權存取的方法。它的工作原理是要求兩種不同的您身份的「證明」。例如,「您知道的某個東西」(如密碼)和「您擁有的東西」,如一個實體密鑰裝置。通常,第一個因素是您已經擁有的密碼,第二個因素可以是您收到的簡訊或是在您手機或另一個設備(「您擁有的東西」)上生成的代碼。Nextcloud 支援多種雙因素身份驗證方式,並且日後可以新增更多支援。

Once a two-factor authentication app has been enabled by your administrator, you can enable and configure it in Setting your preferences.

設定雙因素身份驗證

In your personal settings, look up the Second-factor Auth setting. In this example this is TOTP, a Google Authenticator compatible time-based code:

TOTP 設定。

您將會看到您的密鑰和一個可以被您手機(或其他裝置)上的 TOTP 應用軟體掃描的 QR 碼。根據使用的應用軟體或工具的不同輸入該密鑰或掃描 QR 碼後您的裝置將顯示一個每 30 秒更新一次的登入驗證碼。

Recovery codes if you lose your second factor

You should always generate backup codes for 2FA. If your second factor device gets stolen or stops working, you can use one of these codes to unlock your account. It effectively functions as a backup second factor. To get the backup codes, go to your personal settings and look under Second-factor Auth settings. Choose Generate backup codes:

雙因素身份驗證(2FA)備用代碼產生器

You will then see a list of one-time-use backup codes:

雙因素身份驗證(2FA)備用代碼

Store these codes somewhere safe where you can find them. Do not keep them with your second factor (such as your mobile phone), but store them separately so that losing one does not mean losing the other.

使用雙因素身份驗證登入

After you log out and log in again, you will see a prompt to enter the TOTP code in your browser. If you have enabled more than one second factor, you will see a selection screen where you can choose which method to use for this login. Select TOTP:

選擇一個雙因素身份驗證方法。

現在輸入您的驗證碼:

於登入時輸入 TOTP 驗證碼。

如果輸入的驗證碼是正確的您將被重新導向回您的 Nextcloud 帳號。

備註

Since the code is time-based, it is important that your server's and your smartphone's clock are almost in sync. A time drift of a few seconds won't be a problem.

使用硬體令牌產生器(hardware tokens)來進行雙因素身份驗證

您可以使用基於硬體令牌產生器的雙因素身份驗證方法。下列硬體令牌產生器裝置已知是可用的:

於客戶端應用軟體上使用雙因素身份驗證

Once you have enabled 2FA, your clients will no longer be able to connect with just your password unless they also have support for two-factor authentication. To solve this, you should generate device-specific passwords for them. See Manage connected browsers and devices for more information on how to do this.

考慮事項

If you use WebAuthn to log in to your Nextcloud, be sure to not use the same token for 2FA, as this would mean you are again only using a single factor.