Please help us by providing the following info. Before posting please also check the pinned "Known issues" threads and make sure that you're running the latest available version for your oC release: https://owncloud.org/changelog/
Steps to reproduce
Tell us what should happen
Tell us what happens instead
ownCloud version (see ownCloud admin page):9.1.3
Updated from an older ownCloud or fresh install:fresh
Special configuration (external storage, external authentication, reverse proxy, server-side-encryption):
I'm stuck with a task that seem basic. I need to create for a special temporary need 380 local accounts on an Owncloud 9.1 server.
This account are all in a accounts.txt file with a ; separator like this
My account 1;login1;password1
My account 2;login2;password2
Very simple, the first field is the display name, the second the uid/login, the third the password.
I follow instruction here https://doc.owncloud.org/server/9.0/admin_manual/configuration_server/occ_command.html#user-commands-label
But my shell script does not work, I've always an error
First try with a shell script like this:
#! /bin/bash while IFS=";" read display user pass do export OC_PASS=$pass #echo -e "$display :\n\ # UID :\t $user\n\ # password :\t $pass\n\n" **sudo -u apache php /var/www/html/owncloud/occ user:add --password-from-env --display-name="$display" --group="OWNCLOUD AG EXT" $user** done < /root/accounts.txt
The result is
--password-from-env given, but OC_PASS is empty!
If I just display the fields (see the commented line), it's working.
So I tried the following according to the documentation (su -s)
#! /bin/bash while IFS=";" read display user pass do export OC_PASS=$pass #echo -e "$display :\n\ # UID :\t $user\n\ # password :\t $pass\n\n" **su -s /bin/sh apache -c "php /var/www/html/owncloud/occ user:add --password-from-env --display-name="$display" --group="OWNCLOUD AG EXT" $user"** done < /root/accounts.txt
In this case, I have
Not enough arguments (missing: "uid").
If someone have already created a script like this, you are welcome. In both case, it seems to be a variable not set but I don't know how to keep them. May be it's just a stupid thing I miss...