NextCloud: Create User via CLI
As the NextCloud WebUI had a bug and didn't let me create new users I needed to find an alternative way to do so.
After some digging I found the following method to work and have been using it since:
Substitutethe 'www-data' user:
sudo su -s /bin/sh www-data
As this user, export the password for the new user to the 'OC_PASS' variable:
Call the NextCloud/ownCloud command line tool 'occ' and create the user:
php /var/www/nextcloud/occ user:add --password-from-env --display-name="<username>" --group="users" <username>
Finally, stop substituting by typing:
You should now see the newly created user in the NextCloud/ownCloud web interface.