An authentication factor is a piece of information used to verify that you're allowed to do something, like a keycard used to unlock a hotel door. Two-factor authentication, commonly abbreviated as 2FA, is any form of verification that requires two factors, like withdrawing money from an ATM using both a bank card and its PIN.
Using 2FA adds an additional layer of security against unauthorized access to your account. For example, even if a bad actor gains access to your password, they still can't access anything without also having your phone.
DigitalOcean supports 2FA for accounts in the form of a security code that you use in addition to your password when you log in. You can receive the code via SMS or an authenticator app on your smartphone. We strongly recommend enabling 2FA on all DigitalOcean accounts. Our default account authorization protects accounts without 2FA enabled, but not as effectively as using 2FA itself.
When you first create your account, 2FA is disabled, but DigitalOcean takes other steps to protect your account.
Each time you log in from a new location using a new device or a different web browser, we email an authorization code to the address linked to your account. You'll need to check your email, retrieve the code, and enter it to complete your login.
This means that even without 2FA enabled, a bad actor would need both your DigitalOcean password and your email password to log in. This isn't as effective as 2FA, but it increases the difficulty for would-be attackers and provides you with notification if someone is trying to access your account.
To enable 2FA for your DigitalOcean account, log in to the control panel.
In the main navigation, under the Account heading, click Security. You can also click any of the control panel reminders to enable 2FA.
When you enable 2FA, you'll then need to choose your second factor and choose a backup method. After 2FA is enabled, you can return to the Security page to modify your choices, generate new backup codes, or disable 2FA.
When you click the Enable Two-Factor Authentication button, you'll be asked to choose between using an authenticator app or SMS.
Authenticator apps like Google Authenticator, Authy, or Duo are small, free mobile applications used to generate security codes. They work globally and are more secure than SMS because they don't transmit the security codes across the network.
When you choose this method, you need to scan the provided QR code using the authenticator app on your phone or tablet. This links your device to your DigitalOcean account.
If you're unable to scan the code, click the Try this instead link directly underneath it. This gives you a code which you can enter manually by following the directions in your specific authenticator app. When you enter the code, the app gives you a PIN to enter in the space provided. Once you've entered the PIN, the app links with your DigitalOcean account.
Now that the app and your account are linked together, you'll be prompted for the 2FA code from your app when you log in. You need to open the app on your smartphone to reveal the code, then enter it when prompted in the control panel to complete logging in.
If you select SMS, your mobile carrier must be able to deliver a text message, which means you'll need mobile signal or an Internet connection. This may be inconvenient when traveling internationally. In addition, because SMS messages can be easily intercepted by hackers, they're not as secure as an app. However, using SMS for 2FA still provides much stronger security for your account than not enabling it at all.
When you select SMS, you'll be prompted for the phone number.
Once you enter the code, DigitalOcean sends a code via SMS. When you receive it, you'll enter the code to link your phone and your account. In the future, you'll receive a code via SMS to enter into the control panel to complete your login.
When you're finished configuring your primary method for 2FA, you're prompted to add a backup method. Backup codes are the default selection and recommended method.
Backup codes ensure that if your 2FA device is lost or stolen, you can still access your account. The codes act like a second password and should be stored in a secure place that you can access without your phone. They're visible on-screen and you can also download a
.txt file called digitalocean_backupcodes.txt.
Once you've used a backup code it is no longer valid, so it can be helpful to delete it or cross it out in your records. If you start to run low on backup codes, you can generate more. Note that when you do, any remaining codes from before are no longer valid.
Once you've logged in, open the User profile menu and follow the link to the Security page in the left navigation. When you move the mouse cursor over the Two-factor Authentication Enabled button, the text changes to Disable Two-factor Authentication. Click Disable Two-factor Authentication.
When you select that button, a window titled Disable two-factor authentication? opens to confirm your choice. Click the Yes, Disable 2FA button to disable 2FA.
If you've lost access to your 2FA device or can't receive the code via SMS, try searching your computer for the Backup Codes text file “digitalocean_backupcodes.txt”. If your backup method is not functioning, then you'll need to submit a ticket to the DigitalOcean support team, who can help you restore your access.
If you have enabled 2FA for your account and are using an authentication app, you can change the current app you are using to authenticate your DigitalOcean account by disabling 2FA and then enabling it again using your preferred authentication app.