User creation script

Joachim Backes joachim.backes at rhrk.uni-kl.de
Thu Apr 26 05:35:20 UTC 2007


Tim wrote:
> On Wed, 2007-04-25 at 18:38 -0600, Ashley M. Kirchner wrote:
>>     Anyone have pointers (or examples) of a script that can be used to
>> create new users and set their password at the same time?  I need 
>> something I can call like so:
>>
>>     script USERNAME PASSWORD
>>
>>     ...and have it return 1 or 0 for failure or success. 
> 
> You can't use "useradd" as it already stands?
> 

I think the problem is the password.
Splitting the script in to parts:

1. useradd   .... $1 .......
2. password --stdin <<"EOF"
$2
EOF

so if you call

script <USERNAME> "<PASSWORD>"

the password should be set correctly.

-- 
Joachim Backes <joachim.backes at rhrk.uni-kl.de>
University of Kaiserslautern,Computer Center [RHRK],
Systems and Operations, High Performance Computing,
D-67653 Kaiserslautern, PO Box 3049, Germany
--------------------------------------------------
Phone: +49-631-205-2438, FAX: +49-631-205-3056
http://hlrwm.rhrk.uni-kl.de/home/staff/backes.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6088 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.fedoraproject.org/pipermail/users/attachments/20070426/8fb690d2/attachment-0002.bin 


More information about the users mailing list