# 2fa device lost

**URL:** <https://help.nextcloud.com/t/2fa-device-lost/57569>\
**Category:** ℹ️ Support\
**Created:** [August 1, 2019, 4:04pm UTC](https://help.nextcloud.com/t/2fa-device-lost/57569 "2019-08-01T16:04:04Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkeating178](https://help.nextcloud.com/letter_avatar/bkeating178/32/5_5575768a8748004e209b776fc1b2916d.png) [@bkeating178](https://help.nextcloud.com/u/bkeating178)\
**Post date:** [August 1, 2019, 4:04pm UTC](https://help.nextcloud.com/t/2fa-device-lost/57569/1 "2019-08-01T16:04:04Z")

</div>

Hey everyone,

I have a user that recently got a new phone and all of his 2fa tokens were wiped out. The user is now unable to get into my nextcloud envrionment because it was enforced vai the settings.

Does anyone have an idea what we need to do to get him back in to his nextcloud account?

Thanks

---

<div class="post-metadata">

**Author:** ![j-ed](https://help.nextcloud.com/user_avatar/help.nextcloud.com/j-ed/32/7281_2.png) [@j-ed](https://help.nextcloud.com/u/j-ed)\
**Post date:** [August 1, 2019, 4:25pm UTC](https://help.nextcloud.com/t/2fa-device-lost/57569/2 "2019-08-01T16:25:32Z")

</div>

As an administrator you can use the [impersonate app](https://apps.nextcloud.com/apps/impersonate) to switch to the user profile and adjust the relevant settings, or you can use the `./occ twofactorauth:..`command line tool to remove the 2fa device from the users profile.

---

<div class="post-metadata">

**Author:** ![bkeating178](https://help.nextcloud.com/letter_avatar/bkeating178/32/5_5575768a8748004e209b776fc1b2916d.png) [@bkeating178](https://help.nextcloud.com/u/bkeating178)\
**Post date:** [August 1, 2019, 4:37pm UTC](https://help.nextcloud.com/t/2fa-device-lost/57569/3 "2019-08-01T16:37:10Z")

</div>

Thanks for the quick reply, I will look into the impersonate app. As for the command line options I keep getting syntax errors every time I try to use it. Do you have any commands or switches that may help me out?

Error:

 ![image](https://help.nextcloud.com/uploads/default/original/3X/9/3/930cf9bcf20fc48ba4e902da473abb8d118512bd.png)

---

<div class="post-metadata">

**Author:** ![Schmu](https://help.nextcloud.com/user_avatar/help.nextcloud.com/schmu/32/7823_2.png) [@Schmu](https://help.nextcloud.com/u/Schmu)\
**Post date:** [August 1, 2019, 5:12pm UTC](https://help.nextcloud.com/t/2fa-device-lost/57569/4 "2019-08-01T17:12:49Z")

</div>

The syntax you are using seems strange.

Can you try:  
`sudo -u www-data php occ twofactorauth:disable 550E3E27-CCCE-43AE-8D6C-D4427EC507B7 backup_codes`

and

`sudo -u www-data php occ twofactorauth:disable 550E3E27-CCCE-43AE-8D6C-D4427EC507B7 totp`

---

<div class="post-metadata">

**Author:** ![j-ed](https://help.nextcloud.com/user_avatar/help.nextcloud.com/j-ed/32/7281_2.png) [@j-ed](https://help.nextcloud.com/u/j-ed)\
**Post date:** [August 1, 2019, 5:34pm UTC](https://help.nextcloud.com/t/2fa-device-lost/57569/5 "2019-08-01T17:34:50Z")

</div>

Use e.g. the following command to get a list of enabled 2fa providers for a user and to double-check that you are using the right abbreviation for it:

```auto
./occ twofactorauth:state <user>
Two-factor authentication is enabled for user XYZ

Enabled providers:
- backup_codes
- gateway_telegram
- totp <<< ?!
- u2f
Disabled providers:
- admin
- gateway_signal
- gateway_sms

```

---

<div class="post-metadata">

**Author:** ![bkeating178](https://help.nextcloud.com/letter_avatar/bkeating178/32/5_5575768a8748004e209b776fc1b2916d.png) [@bkeating178](https://help.nextcloud.com/u/bkeating178)\
**Post date:** [August 2, 2019, 6:13pm UTC](https://help.nextcloud.com/t/2fa-device-lost/57569/6 "2019-08-02T18:13:42Z")

</div>

Thanks everyone, I was able to use the impersonate app and remove it for the user.

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 4, 2024, 10:12am UTC](https://help.nextcloud.com/t/2fa-device-lost/57569/7 "2024-12-04T10:12:12Z")

</div>



---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 11, 2024, 3:24pm UTC](https://help.nextcloud.com/t/2fa-device-lost/57569/8 "2024-12-11T15:24:35Z")

</div>


