Nextcloud – How to Reset Password Nextcloud Admin using CLI

Got locked out of your administrative account on Nextcloud? Don’t reset your installation just yet. You can reset your account quickly and easily using the steps below.

To reset an account called admin (if you project folder is in a different directory than /var/www adjust path to suit)

Run this command:

$ sudo -u www-data php /var/www/nextcloud/occ user:resetpassword admin
Enter a new password:
Confirm the new password:
Successfully reset password for admin

On shared hosting without access to sudo you can try the following instead.

$ php /var/www/nextcloud/occ user:resetpassword admin

Your installation folder path may need to be updated to match the location of your Nextcloud install

Leave a Reply