Bulk User Import

9.0.x
help

#1

Hi,

Apologies if this is obvious or been answered before.

We have an OwnCloud server which we allow project partners to access. As such we use the user's e-mail address for their UID. This has not caused us a problem in the past; however, I have a bulk creation of around 40 users to do and as such have discovered the occ command line functionality.

I have a : delimited file with the format, per line, of:
Bob Smith:bob@company.com

I have then tried to create the accounts using:

export OC_PASS=newpassword
while IFS=: read -r name email; do su -s /bin/sh www-data -c 'php occ user:add --password-from-env --display-name="$name" --group="PROJECT" $email'; done <file.txt

with this I receive an error:

Not enough arguments (missing: "uid")

if I then put the $email in "" I receive:

  A valid username must be provided

I have also tried putting the "" around the e-mail address in the text file.

It may simply be that I am unable to create users for ourselves in the way; equaly so I will freely admit that I am relatively new to php (and the occ tool) so I could be missing something incredibly simple and obvious.

Any quidance in much appreciated.

Andy


#2

Just a quick hint:

Switching users changes your env. Maybe try to run the script itself as user www-data or use sudo -e to preserve your env.


#3

Hi

We use OC on premise with about 300 users, it's version 8.0 I've just installed version 9.14 on our webspace with Godaddy.

Is there a way of importing our old users in bulk?