How to reset NextCloud Admin Password using command

Have you forgotten your NextCloud Server login password? Then here are the steps to reset your Admin password using the command line of the server where you have installed it.

NextCloud is popular for providing a self-hosted platform to store and access media and documents from anywhere, just like Dropbox. It also offers apps to edit documents, view images, calendars, and more… Well, the thing which may create problems is the habit of forgetting things such as a complicated password. It is very common, we set some strong passwords to enhance the security but later forget the same. That’s why it is recommended to use the Open source Password Manager Application.  or have a look at Best Free Password Managers for Windows 10 | 11 in 2022.

Well, come to the main topic, if you have an active e-mail on NextCloud then you can easily use that to reset your password. Just click the password reset link on the login screen, which appears after a failed login attempt. However, this method is only applicable like I said if you have added your email address in the Nextcloud Web interface. But what if you didn’t do that? In that case, we can use our server command terminal to reset the NextCloud Admin interface where we have installed it.

Steps to reset NextCloud Admin password

Requirements

NextCloud installed server
Root or non-root use with sudo access
Access to server’s terminal

 

Go to Command Terminal

If you have direct access to the terminal of your server then you can go for the next step. Whereas, if not then remotely access it using SSH so that we can issue the commands with sudo access.

 

Reset NextCloud Admin Password

The Nextcloud folder that holds all the files we are required to run its server, placed under our webroot directory, comes with a tool called OCC. That we can use to reset our Admin user password.

Here is the command syntax to reset password:

 sudo -u apacher-user php  path-to-nextcloud-folder user:resetpassword username 

Note: Replace the apache user, the path to the next cloud folder, and username as per your system

Example:

For RedHat, CentOS, Alamlinux, Rocky Linux, oRacle Linux, and other RPM-based OS

sudo -u apache php /var/www/html/nextcloud/occ user:resetpassword admin

For Ubuntu, Debian, Linux Mint, and other similar distros. 

sudo -u www-data php /var/www/html/nextcloud/occ user:resetpassword admin

 

Enter New Password

When you run the above-given command to reset the password, the script will ask you to enter the new one pass, two times. So, what are you waiting for type the new admin password you want to set.

Reset Admin Password NextCLoud

 

Login to NextCloud

Once the Admin password is updated, again go to your NextCloud web Interface and login with the username and password you have set for it.

 

Other Articles:

Install Nextcloud Client on Debian 11 Bullseye Linux
Install NextCloud server on AlmaLinux 8 
How to install NextCloud on Debian 11 Bullseye Linux
Centos 7 Linux Forgot Password Solution- How to Change it

 

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.