From francois.patte at math-info.univ-paris5.fr Fri Jun 5 17:30:08 2015 Content-Type: multipart/mixed; boundary="===============2268469328846564081==" MIME-Version: 1.0 From: =?utf-8?q?Fran=C3=A7ois_Patte_=3Cfrancois=2Epatte_at_math-info=2Euniv-par?= =?utf-8?q?is5=2Efr=3E?= To: users at lists.fedoraproject.org Subject: Re: User creation script Date: Thu, 26 Apr 2007 14:52:13 +0200 Message-ID: <4630A07D.7080607@math-info.univ-paris5.fr> In-Reply-To: 462FF499.7090302@pcraft.com --===============2268469328846564081== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ashley M. Kirchner a =C3=A9crit : > = > 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 not exactly, here a script I have done to had user from a list, you can adapt it to fit your needs. This script create users with temporary crypted password, add them to the mail server and crate an elementary web page... Choose what you want (sorry for comments in French!): #!/bin/bash cat < list-of-users | while true do read ligne if [ "$ligne" =3D "" ]; then break; fi echo "lecture de la ligne --->" $ligne set -- $ligne PRENOM=3D$1 PRENOM2=3D$2 NOM=3D$3 LOGIN=3D$4 COURRIER=3D$5 LIEU=3D$6 GROUP=3D$7 PASSWD=3D`echo $PRENOM | cut -c1``echo $NOM | cut -c1`2005 # echo prenom=3D$PRENOM, prenom2=3D$PRENOM2 nom=3D$NOM login=3D$LOGIN passwd=3D$PASSWD courrier=3D$COURRIER lieu=3D$LIEU # #creation des utilisateurs CRYPTPASSWORD=3D`/usr/sbin/slappasswd -h {MD5} -c '$1$%.8s' -s $PASSWD | cut -d "}" -f2` /usr/sbin/adduser -s /usr/bin/rssh -p $CRYPTPASSWORD -g $GROUP $LOGIN echo "$COURRIER, \\$LOGIN" > /home/$LOGIN/\.forward # #courrier mkdir /home/$LOGIN/mail/ cp /root/.subscriptions /home/$LOGIN/mail/ echo "$PRENOM2.$LOGIN: $LOGIN" >> /etc/mail/aliases echo "$LOGIN: $PRENOM2.$LOGIN" >> /etc/mail/revaliases # #page web mkdir /home/$LOGIN/public_html cat << xxFINxx > /home/$LOGIN/public_html/index.html
![]() |
---|