# OTP Settings

## Constraints: It requires Enterprise License.

**OTP / MFA / 2FA settings:**

This settings allows you to configure **Two Factor** authentication.\
This feature also supports software-based authenticator applications such as **Google Authenticator** and **Microsoft Authenticator**. For more information, see the [Authenticator Link](Authenticator.md)

OTP's are primarily intended for web interface logins. Variants like **Google Authenticator (TOTP)** would be straight meaningless for **FTP**, **SFTP**, since it's impossible enroll anyways.

A hidden flag in **prefs.XML** controls for which protocols OTP should be enabled by default:

```
<twofactor_secret_auto_otp_enable_protocols>ftp,ftps,sftp,http,https,webdav</twofactor_secret_auto_otp_enable_protocols>
```

You can customize the OTP token length by going to **Shares** ([Manage Shares Link](Manage-Shares.md)) **-> General Settings**, and adjusting the value in the **Length of auto-generated username and password** input field.

![Otp token length config](OTP-Settings/otp_token_length_config.png)

---

#### 1. Ensure that Validated Logins is enabled to allow two-factor authentication

![Otp validate logins](OTP-Settings/otp_validate_logins.png)

**[DMZ](DMZ.md)** - Main node scenario: on **Preferences -> General Settings -> OTP section** the **Validated Logins** option must be enabled on the DMZ node, so the DMZ gives the two-factor authentication to the Main node.

---

#### 2. Supported OTP Methods

#### 2.1 SMS OTP Configuration

\- You must have a twilio account. Using Twilio: [Twilio Link](https://www.twilio.com/)

---

**⚠️ Proxy Configuration:** If your server accesses the internet through a proxy, make sure to whitelist the following domain: **api.twilio.com**

---

The **ACCOUNT SID** as **Username** and **AUTH TOKEN** as **Password**:\
![Twilio 3](OTP-Settings/twilio3.png)\
URL:

```

https://{otp_username}:{otp_password}@api.twilio.com/2010-04-01/Accounts/{otp_username}/Messages.json
```

API post :

```

To={otp_to}&From={otp_from}&Body={otp_token}
```

Provide your twilio phone number.

![Otp sms](OTP-Settings/otp_sms.png)

**⚠️ Important**: The configuration will apply only to users who have a phone number (Go to [User Manager](User-Manager.md) -> Select the user).

![Otp user settings phone](OTP-Settings/otp_user_settings_phone.png)

#### 2.2 Email OTP Configuration

Email usage requires an **SMTP Server** configured in the **Preferences -> General Settings** (See at [General Settings](General-Settings.md)). **Note:** Make sure your SMTP server is properly configured and functioning.

**URL:** SMTP\
**⚠️ Important** Just those 4 uppercase letters, nothing else.

![Otp email](OTP-Settings/otp_email.png)

This configuration applies only to users who have an email address and have the **Two-factor OTP/SMS authentication** flag enabled in the [User Manager](User-Manager.md).

The email can be customized by creating an **Email Template** (More info at [Email Templates](Email-Templates.md)): **Two Factor Auth**

![Otp email template](OTP-Settings/otp_email_template.png)

**⚠️ Important**: Variable for the One Time Password:

```
{auth_token}
```

You can personalize the **OTP Email Content** for individual users by creating an **Extra Text Reference** on the user account. Then, insert that reference into the email template to customize the message per user.

![Otp user extra text ref](OTP-Settings/otp_user_extra_text_ref.png)

Like :

```
{user_x_otp_email_body}
```

![Otp email template 2](OTP-Settings/otp_email_template2.png)

---

#### 3. Configuring OTP Settings for Users

To enable OTP for a user (Go to [User Manager](User-Manager.md) -> Select the user, or choose the **default** user to apply the settings to all users), check the **Two-factor OTP/SMS authentication** setting in the user configuration.

Make sure the required **protocol** is enabled.

**(Optional)** You can also configure the OTP to remain valid for multiple days.

![Otp user settings](OTP-Settings/otp_user_settings.png)
