Auto User Creation + random Password + expire time

G´day community,

so NC 15 in running, i need to way to create Auto Users + random passwords. The User Accounts will expire after 14 days. Is there any chance to get this constellation running?

best regards


I think you can read about here:

export OC_PASS=newpassword
su -s /bin/sh www-data -c 'php occ user:add --password-from-env
  --display-name="Fred Jones" --group="users" fred'
The user "fred" was created successfully
Display name set to "Fred Jones"
User "fred" added to group "users"

You can generate pass e.g. with gpg for 16 Symbols: export OC_PASS="$(gpg --armor --gen-random 1 16)"

Thank you, the thing ist I need to create Nextcloud Auto Users. Using this method would be manually.

Hi sunny,

please could you give us a more specific explanation of “Auto Users”? Do you want people to be able to register themselves?

What is yours expectation on a trigger when users should be created? May be you can use Registration app?

@CFelix @gas85

Thats the plan:

  • User will sign up with his profil on a different page, this page will be “connected” to NC
  • meanwhile NC will create an auto user and a random password wich will be deleted after 14 days
  • User will get an e-mail with his generated login details

Try to use Nextcloud API for this:
To delete user after 14 Days you need to write some script that will do this.

1 Like

That´s the next point. Theres no “/ocs/v1.php/cloud”

There should be a folder called ocs within your Nextcloud installation on the server. In that folder you should find providers.php, v1.php and v2.php - The cloud part is a class being executed in that PHP file.

This is how it looks on my server:

├── 3rdparty
├── apps
├── config
├── core
├── lib
├── ocm-provider
├── ocs
│   ├── providers.php
│   ├── v1.php
│   └── v2.php
├── ocs-provider
├── resources
├── settings
├── themes
└── updater

I´ll start from the beginning:

NC is running on a Univention VM appliance - we´re able to find the php file, but theres no cloud part in it (except the e-mail adresses of the devolpers)

That’s why I said that it is a class being executed in that PHP file :wink:

The cloud part is somewhere in the source code of NC but I’m not sure why this is bothering you?

Just read the API documentation @gas85 provided, which explains the API and on which base you can build your script.


Just a little cURL example:

curl -X GET \
-H "OCS-APIRequest:true"