'Trying to login after 2-factor authentication results in "wrong verification code. please try again"

I was not able to login to my Synology NAS (running on DSM 7) after I've enabled 2-factor authentication.

Searched a solution I ended up to this page: https://kb.synology.com/en-uk/DSM/tutorial/How_to_reset_my_Synology_NAS#x_anchor_id9

But they suggest to backup the system and I was not able to backup as I couldn't access. Well, probably I could mount the drive and backup from that but I wanted to find another solution.



Solution 1:[1]

You need to have SSH enabled and your account need to be an administrator.

  1. login trough SSH using your account
  2. to add a password to the default admin account, issue this command: sudo synouser --setpw admin 1
  3. your admin account should be disabled, so you need to enable it in order to access trough the web interface. To do so: sudo synouser --modify admin admin 0 [email protected]
  4. now open the web interface and you will be able to login as admin, use password 1.
  5. open "control panel" > "users & groups"
  6. select the user that cannot login anymore and click on Edit
  7. disable 2-factor authentication

sign out and you will be able to login again.

Be sure to disable the 'admin' account again for security reasons.

Some useful info came from this document: https://global.download.synology.com/download/Document/Software/DeveloperGuide/Firmware/DSM/All/enu/Synology_DiskStation_Administration_CLI_Guide.pdf

Solution 2:[2]

Search in the settings for "NTP". You will then find a "Regional Options" Pane where you can set the NTP-Server. A simple synchronize now solved my problem.

Solution 3:[3]

Be careful to setup correctly your timezone. For me the issue was that I live in switzerland, I had the timezone setup on the first gmt+1 I found. And I assume somehow at the daytime yearly switch, the 2FA wasnt calculated properly anymore. I tried to sync the NTP several time, and at the end I switched to the Paris time, which is the one applied in switzerland, and it worked.

Solution 4:[4]

Try to login using E-Mail 2 Factor.
Check your auth app.
Reinstall you auth app.
Set your Timezone on NAS and Phone to your correct, e.g. Paris.

My las idea:
Login via SSH, Telnet excisting SMB connection, download all important files/send all important files to a cloud. Reset NAS manual.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Camaleo
Solution 2 lukas
Solution 3 rwan
Solution 4 aWebDesigner123