Passwd --stdin pipe

Keith Morse kgmorse at mpcu.com
Tue Mar 30 01:10:33 UTC 2004


On Mon, 29 Mar 2004, glenn wrote:

> #!/bin/sh
> 
> # This script takes a list of user IDs (first column)
> # and passwords (second column), and creates user
> # accounts on the Linux server.
> 
> for i in $(awk '{print$1}' students)
> do
> useradd $i
> grep $i students |awk '{print$2}'| passwd --stdin $i
> done
> 
> ###### That's it! ########


It would be good to put in a test on the UID field so that system accounts 
are not included.  (UIDs less than 500 or 65535).







More information about the redhat-list mailing list