On Tue, 01 Sep 2015, Chris Mohler wrote:
Hi List,
I'm trying to make a script to add users non interactively with ipa
add-user and specify a password of testpw
I tried:
ipa user-add username --first=firstname --last=lastname
--homedir=/home/username --password testpw --gidnumber=0000
--noprivate --shell=/bin/bash
#ipa: ERROR: command 'user_add' takes at most 1 argument
and this:
ipa user-add username --first=firstname --last=lastname
--homedir=/home/username --password=testpw --gidnumber=0000
--noprivate --shell=/bin/bash
#ipa: error: --password option does not take a value
No Luck.
Any suggestions?
Read the help :)
$ ipa help user-add|grep -- --password
--password Prompt to set the user password
E.g. --password option does not take *any* parameter, it *prompts* to
enter the password and expects standard input to provide the password.
In the first example you added a parameter after --password and since
--password does not consume anything, it was considered as another
argument but 'ipa user-add' indeed takes a single argument, thus an
error.
In the second example you are explicitly forcing --password to take some
parameter and is told that it does not accept anything, just like help
is saying.
What you want can be achieved like this:
$ cat /my/password/file | ipa user-add username --first=firstname
--last=lastname --password
--
/ Alexander Bokovoy
--
Manage your subscription for the Freeipa-users mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-users
Go to http://freeipa.org for more info on the project