saslpasswd for batch adds

Nikola Milutinovic Nikola.Milutinovic at ev.co.yu
Wed Jul 2 01:48:23 EDT 2003


> However I am noticing that there is no documentation
> on adding all these Cyrus users to the sasldb2. What
> is the best way to handle this with more than a few
> thousand users. I looked at the man page for
> saslpasswd2 and it wasn't clear if it was capable of
> taking input from a tab delimited user/password file.
> We are using auxprop by the way. If anyone can share
> their experience or suggestions with this I would
> greatly appreciate it.

Organize your user/pass information as tab delimitered rows:

user1    pass1
user2    pass2

Then:

#!/usr/bin/zsh

USER_FILE=/home/j/joe/users-list.txt
APP="imap"
DOM="Machine.your.domain.com"

cat ${USER_FILE} | while read line; do
    username=`awk '{print $1}'`
    password=`awk '{print $2}'`
    echo "${password}" | saslpasswd2 -c -p -a ${APP} -u ${DOM} "${username}"
done

Nix.





More information about the Info-cyrus mailing list