Batch adding users (e.g. from list file)

Hi, I made a Python CLI tool for that:
Just posted here as well: Import Many Users

Just paste your data correctly into the users.csv and config.xml and execute the program.
This tool is executed locally and uses the Nextcloud API on your instance.

It’s not a beauty, but it does the job :slightly_smiling_face:

1 Like

Do you know if this will work with a “snap” install of Nextcloud? I’m getting the following error:

HTTPSConnectionPool(host=‘’, port=443): Max retries exceeded with url: /ocs/v1.php/cloud/users (Caused by NewConnectionError(’<urllib3.connection.VerifiedHTTPSConnection object at 0x0000020B989262E8>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it’))
The CURL request could not be performed.

I did not try it with a snap install, but since it uses the NC API, it should work.

Do you use a self signed certificate?
Or a plain HTTP connection?
It will only work with HTTPS connections on port 443 i guess. And I did not try it with a self signed cert :smirk:

Seeing the WinError: do you have a linux machine running somewhere? Maybe as virtual machine? You could try on linux, maybe some windows-voodoo is blocking something…

Thanks for the response - I needed to convert to https, and it now works, thank you.

Great, happy to help :slightly_smiling_face:


and thanks, how can I run this script? Do I need really the python environment for, what is the correct usage.

My nextcloud version is 17.0.1 running on 18.0.4 LTS

Maaaany thanks


No, you don’t need to install python. It is included in the pre-built packages:

Follow the instructions here:

If it doesn’t work just send me a message. There are some bugs I will fix in the next days and make a new build :slightly_smiling_face:

Cool, it worked for me now! But I have to provide passwords, otherwise I get this error:

Traceback (most recent call last):
File “”, line 94, in
IndexError: string index out of range
[31114] Failed to execute script nc-userimporter

Hey Dexter !

Thank you for the tools, its really smart.

But I have a problem … Can you help me ?

I have an ssl error when I try to import the user.
I was thinking thats about the auto-signed certificate but its look like the python certificate.

Error is SSL: CERTIFICATE_VERIFY_FAILED certificate verify failed (_ssl.c:645)

Do you have already this error ?

I’m on CentOS 7.

Thank you !


I will build a version, where passwords can be left empty.

I’m afraid self-signed certs are not handled yet, sorry.

I have put this on the todo list and will try to make it work soon.

Self signed certs do work now. :slightly_smiling_face:
Just set the value <sslverify> in the config.xml to False

Hey ! Thank you Dexter, i give you a feedback when I tried

I just tried but the script says that the users.csv file doesn’t exist. Yet it is there, in its place, at the same level as the script…
Where is the error? Encoding (UTF-8, LF) ? Should I keep the first line of the csv file (username;displayname;…)?
Thanks !

“doesn’t exist” means that the file couldn’t be found or it cannot be accessed due to missing access rights. Please describe in detail under which os and user you’re running the script, show the file access rights of the cvs file and which command you are executing.

Could someone help me out with the script? I’m trying to use it and getting the following error. Not sure what it might be:

Copyright © 2019-2020 Torsten Markmann (t-markmann), &
Contributors: Johannes Schirge (Shen), Nicolas Stuhlfauth (nicostuhlfauth)
This program comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it under certain conditions.
For details look into LICENSE file (GNU GPLv3).

Traceback (most recent call last):
File “”, line 84, in
File “”, line 1, in
NameError: name ‘false’ is not defined
[10808] Failed to execute script nc-userimporter

I am running on Windows 10 using the supplied windows exe. I’ve double checked the config file and csv, everything seems to be in order.

Did you change <sslverify>True</sslverify> to <sslverify>false</sslverify> ?
<sslverify>False</sslverify> should work.

Hi, I have the same problem.
I use the executable on macOS 10.14.6.
I changed the permissions and tried with a minimal csv file (with 2 users) to test.

What can I do? Please help me, I have 200 users to import…

“doesn’t exist” means that the file couldn’t be found or it cannot be accessed due to missing access rights. Please describe IN DETAIL under which user you’re running the script, show the file access rights of the cvs file and which command you are executing.

1 Like

Ok, thank you very much for this reminder (which you had already given, excuse me).
I tried it again differently and it works now.

My mistake was that I was launching the nc-userimport executable with a double-click as indicated by the readme on Github. By running it with the command ./nc-userimport it works perfectly.

I’m a novice with the terminal but I’m constantly learning :slight_smile:
Your comment put me on the right track!

1 Like