How to enable 2FA (2-factor authentication) in CLI
How can 2-factor authentication help me?
2-factor authentication (2FA) adds one more layer to your login process, but it’s worth it. It helps protect your account even if someone steals your password. When trying to log in, after you type in your password, you’ll also need to enter a code from your phone or app: even if someone knows your password, they still can’t get in, making it way harder to hack.

How to enable 2FA
Before using 2FA commands, use xcli login
to get yourself a token. Failure to log in before performing 2FA tasks will cause token errors.
Enable 2FA for the user
If you wish to activate 2FA for the current user in Multilogin X CLI:
- Enter
xcli enable-2fa --device devicename
-
devicename
→ choose the name it will appear in the 2FA application
-
- Once the command is parsed, the CLI tool will automatically generate a QR code

- Open your desired authenticator app (such as Google Authenticator, Microsoft Authenticator)
- Choose to add a new QR code and scan the output → this will create an entry in your authenticator app called
MLX
- Note: if you already have an authenticator input called MLX, you will be prompted to choose a new name
- Find the code shown in your authenticator → type it into the code area
- Once done, you will see a success message alongside your backup codes. Store them in a safe place.


Backup codes are one-time-use codes, emergency keys that let you log in if you lose access to your app or phone.
Enable 2FA for the workspace
Want to activate the use of 2FA for all users in the workspace, instead of just your own? Follow the steps below:
- Make sure you have completed all the steps to enable 2FA in the previous section
- Once the activation is complete, you are able to activate this same key for the workspace
- Enter
xcli enable-2fa-for-workspace

How to disable 2FA
Disable 2FA for the user
Disabling 2FA is even easier than enabling it! Just enter xcli disable-2fa
and that's it! No flags needed. Your previously enabled 2FA will be turned off.

Disable 2FA for the workspace
Disabling 2FA for the workspace affects all its members. To proceed, just enter xcli disable-2fa-for-workspace
, no extra flags needed.

How to view 2FA backup codes
Need to recheck your backup codes? It is as easy as one-step in CLI! It is easy to check what are your current backup codes. Just type view-backup-codes

2FA commands table
Command/Type |
For a specific user |
For everyone in the workspace |
Enable 2FA |
|
|
Disable 2FA |
|
|
View backup codes |
– |
|