--password-from-env given, but OC_PASS is empty!

10

#1

I want to import multiple users, defining :
- the group they belong
- their password
- their email
- their username

Running this:

sudo -u www-data php occ user:add --email="myemail@domain.com"  --group="users" myusername

asks me then to type a password. Can I avoid this step and in the same command to define the password for the user?
Something like

sudo -u www-data php occ user:add --email="myemail@domain.com"  --group="users" --pasword="mypass" myusername

(I know the "--pasword" option does not exist.)

UPDATE

I tried the following..

export OC_PASS="newpassword"
sudo -u www-data php occ user:add  --password-from-env --email="email@domn.com" --group="users" myusername

and I got

--password-from-env given, but OC_PASS is empty!

Server configuration

Operating system: Ubuntu 16.04

Web server: Apache2

Database: MySQL

PHP version: PHP Version 7.0.22-0ubuntu0.16.04.1

ownCloud version: 10.0.3.3

Updated from an older ownCloud or fresh install: fresh

Where did you install ownCloud from: owncloud

Signing status (ownCloud 9.0 and above): No errors have been found.


#2

Ok I found it..

`export OC_PASS="newpassword"
 su -s /bin/sh www-data -c 'php occ user:add --password-from-env --email="myemail@domain.com" --group="user" myusername'`