Just humbly wondering:
Is this taken into account or merely ignored without comment?
There is an API that can be used to create users. There is for example a small python library that can be used to add users:
Thanks for the hint! I will look into it.
Nonetheless, I think it would still be great to be able to do it inside NC.
You can also use the Nextcloud command line interface to create users: ./occ user:add <uid>
. A small batch file would do the rest
I wrote a small script for batch-adding users from a CSV file, based on that library.
Iâll open-source it some time.
Hi, I made a Python CLI tool for that: https://github.com/t-markmann/nc-userimporter
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
Do you know if this will work with a âsnapâ install of Nextcloud? Iâm getting the following error:
HTTPSConnectionPool(host=âexample.comâ, 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
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
Hello,
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
Haydar
Hi!
No, you donât need to install python. It is included in the pre-built packages: https://get.edudocs.org/de/assets/nc-userimporter/
Follow the instructions here: https://github.com/t-markmann/nc-userimporter#instructions
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
Cool, it worked for me now! But I have to provide passwords, otherwise I get this error:
Traceback (most recent call last):
File ânc-userimporter.pyâ, 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 !
CJU
I will build a version, where passwords can be left empty.
Hi CJU,
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.
Just set the value <sslverify>
in the config.xml to False
Hey ! Thank you Dexter, i give you a feedback when I tried
Hi
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.