Reset NextCloud admin password – Snap package

The regular command to reset the password for a NextCloud user does not work when NextCloud is installed from a snap package.

$ sudo -u www-data php /var/www/nextcloud/occ user:resetpassword admin
Could not open input file: /var/www/nextcloud/occ

The reason is that NextCloud is located in “/snap/nextcloud”

Unfortunately the occ file is not located in /snap/nextcloud/current/

However, you can run the nextcloud.occ command directly without specifying the path. Change admin to your user.

sudo nextcloud.occ user:resetpassword admin

Type in the new password twice and login.

Install NextCloud on Ubuntu 19.04

Install with snap

sudo snap install nextcloud 

Set user and password for NextCloud

sudo nextcloud.manual-install nextcloudadmin password

Allow https access for firewall

sudo ufw allow 80,443/tcp

For the following steps to work, you’ll need an A record setup on your domain name server to point a domain to your Next Cloud servers public ip address. Change www.example.com in the following steps to the domain name you’ve setup.

View trusted domains

sudo nextcloud.occ config:system:get trusted_domains

Setup new trusted domain. Change www.example.com with your domain.

sudo nextcloud.occ config:system:set trusted_domains 1 --value=www.example.com

Run through Lets Encrypt to setup a SSL certificate.

sudo nextcloud.enable-https lets-encrypt

Should be able to access NextCloud from a web browser www.example.com

Extra info
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-nextcloud-on-ubuntu-18-04