I am faced with the problem of mass creation of users in nextcloud.
I use ubuntu server, nginx, postgresql.
Using oc commands, I create users in nextcloud. Here is the code:
for user in "${LINES[@]}"; do
username=$(echo $user | cut -d: -f1)
password=$(echo $user | cut -d: -f2)
echo "Имя:"
echo "$username"
echo "Пароль:"
echo "$password"
echo "Конец итерации"
export OC_PASS=$(echo $user | cut -d: -f2)
echo "Пароль - GLOBAL:"
echo "$OC_PASS"
su -s /bin/sh www-data -c "php $OCC user:add --display-name="$username" --password-from-env --group="$GROUP" $username"
done
As you can see, the global environment variable OC_PASS is declared in the iteration. The problem is that after executing the code, I can't get in by login and password, it gives an error
But if you take out the declaration of the OC_PASS variable from the iteration, then everything works correctly. What could be the problem?
I'm trying to create a script for many users in NextCloud at once.