From: Andy H. <ajh...@gw...> - 2003-04-02 18:36:59
|
-----BEGIN PGP SIGNED MESSAGE----- Maybe someone will find this useful. We use radius auth here and I used this rip the userid's with a valid shell out of a passwd file (from another server) and generate an sql file for easy insertion into the core users table. egrep ':\/bin\/(tcsh|bash|csh|sh)$' /etc/passwd | egrep -v '^(archiver|bin|calltrak|cricket|cvs|disk|hostmaster|mrtg|mysql|operator|postgre s|request|root|rt|sys|webrptmgr|www):' | sort | awk -F\: '{print $1"\t"$3"\t"$5}' | awk -F\, '{print $1}' | sed 's/\.//g' | awk -F'\t' '{print "insert into users ( id, name, fullname, \"password\", email, admin, deleted ) values ( \047"$2"\047,\047"$1"\047,\047"$3"\047,\047NONE\047,\047"$1"@example.com\047, \047f\047,\047f\047 ) ; "}' It's a one liner, so remove all the line breaks. Since I use radius, I have the pw set to NONE, but you could just as easily put it to a default hashed passwd if you didn't mind everyone having the same pw and changing it after. Note that it uses the uid from the passwd file as the id in the core users table which will help keep it consistent. ~~ Andy Harrison Great Works Internet System Operations (full headers for details) -----BEGIN PGP SIGNATURE----- Version: PGP 6.5.8 iQCVAwUBPostz1PEkLgodAWVAQH/8QP/TIdUoVgzxWqQ9EzLSk//BfWsbMpTj6kl W08JYfPXFPOvV8LQ9am1Ttul7R/5H2UOP/ChQ04UVX+DSwZ2cLtF3cpIHYxR9ppa uh8jRLDPZrNqYDH8ugrJcEDkRZUbfkBTmFzNCb7JZC4eTEJaIgg4IYD/B5rXYoQy jDbBHW6aW80= =agpY -----END PGP SIGNATURE----- |