useradd fails - skript to generate users

Franz Waldmüller waldbauernbub at gmx.at
Fri Jun 12 00:47:05 UTC 2009


Hi
If somebody could help me to fix this:
i am working on a skript to autogenerate users from a list and to asign 
a password to them
The skript below alwas fails with the -p or --password command.
I am working on a ubuntu 8.04 system.


#!/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'
  useradd --password $PASS -m -d $HOME_BASE/$USER $USER -e 2009-12-31
done

---
here the output says:
user $PASSWORD already exits

------
  useradd -g $GROUP --password $PASS -m -d $HOME_BASE/$USER $USER -e 
2009-12-31

in this case the output says: group --password does not exist.

Some urgent hints would be very good. I need a user list with passwords 
for an server access. Promised a friend to realize this for his wedding 
party
thank you very much.
Franz




More information about the ubuntu-users mailing list