procmail
[Top] [All Lists]

procmail, sendmail, directories, whatever

2000-10-15 02:20:45
Philip suggested to jello,

|       #!/bin/sh
|       letters='a b c d e f g h i j k l m n o p q r s t u v w x y z'
|       for i in $letters
|       do
|           mkdir -m 755 /var/mail/$i 2>/dev/null
|           for j in $letters
|           do
|               mkdir /var/mail/$i/$j 2>/dev/null
|           done
|           chmod 1777 /var/mail/$i/?
|       done

Would it not perhaps be better to have only the directories needed for
existing usernames?

#!/bin/sh
cd /var/mail
sed 's-\(.\)\(.\).*-\1/\2-' /etc/passwd | uniq | \
 while read dir
 do
    test -d $dir || mkdir -p $dir
 done
chmod 755 ?
chmod 1777 ?/?

The procedure for creating new accounts thereafter could include similar code:

#!/bin/sh
# new username is $1 on command line

cd /var/mail
echo $1 | sed 's/\(.\)\(.\).*/\1 \2/' | \
 while read first second
 do
    test -d $first/$second && exit
    test -d $first && firstwasthere=yes
    mkdir -p $first/$second
    test -z "$firstwasthere" && chmod 755 $first
    chmod 1777 $second
 done



_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>