useradd fails - skript to generate users

Markus Schönhaber ubuntu-users at list-post.mks-mail.de
Fri Jun 12 08:56:30 UTC 2009


Franz Waldmüller:

> #!/bin/bash
> 
> # NEW_USERS="/path/to/text_data_file"
> # user1.txt is a textfile with three columns user password group
> NEW_USERS="/media/data/user1.txt"
> HOME_BASE="/media/ext3ftp/homeftp"
> 
> cat $NEW_USERS | \
> while read USER PASSWORD GROUP
> do
> PASS='mkpasswd $PASSWORD'

You probably wanted to use backticks "`" or $(...) instead of "'" here.
Otherwise $PASS will be "mkpasswd $PASSWORD" verbatim.

>   useradd --password $PASS -m -d $HOME_BASE/$USER $USER -e 2009-12-31
> done
> 
> ---
> here the output says:
> user $PASSWORD already exits

-- 
Regards
  mks




More information about the ubuntu-users mailing list