Resetting a user’s password in NextCloud

Resetting a lost admin password

The normal ways to recover a lost password are:

  1. Click the password reset link on the login screen; this appears after a failed login attempt. This works only if you have entered your email address on your Personal page in the Nextcloud Web interface, so that the Nextcloud server can email a reset link to you.
  2. Ask another Nextcloud server admin to reset it for you.

If neither of these is an option, then you have a third option, and that is using the occ command. See Using the occ command to learn more about using the occ 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

If your Nextcloud username is not admin, then substitute your Nextcloud username.

unRAID docker: /config/www/nextcloud
unRAID user: abc

$ sudo -u abc php /config/www/nextcloud/occ user:resetpassword admin

Force a file scan in NextCloud

To force a scan after a manual file transfer, for example, can be done as follows:

sudo -u www-data php occ files:scan --all
Usage:
  files:scan [-p|--path="..."] [-q|--quiet] [-v|vv|vvv --verbose] [--all]
  [user_id1] ... [user_idN]

Arguments:
  user_id               will rescan all files of the given user(s)

Options:
  --path                limit rescan to the user/path given
  --all                 will rescan all files of all known users
  --quiet               suppress any output
  --verbose             files and directories being processed are shown
                        additionally during scanning
  --unscanned           scan only previously unscanned files

Source: https://docs.nextcloud.com/server/15/admin_manual/configuration_server/occ_command.html