[Freeipa-users] Ipa add-user non interactively specifying a password.

Alexander Bokovoy abokovoy at redhat.com
Tue Sep 1 19:39:37 UTC 2015


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




More information about the Freeipa-users mailing list