Neyse, bırakıp gitmek olmaz, bunları düzeltelim.
########################################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
#
# serkan.capkan@gmail.com - 23.10.2009
#
########################################################################################
#!/bin/sh
#sabitler
tmp_passwd="/tmp/$0_passwd_gecici"
tmp_passwd_tmp="/tmp/$0_passwd_gecici_tmp"
klasor="/home/vmail"
subs_tmp="/tmp/$0_subs_tmp"
sistem_users="root bin daemon adm lp sync shutdown halt mail news uucp operator games gopher ftp nobody nscd vcsa pcap rpc mailnull smmsp rpcuser nfsnobody sshd dbus avahi haldaemon avahi-autoipd apache ntp mysql dovecot postfix clamav distcache named mailman amavis xfs"
date; echo "BASLADI ------------------------------------------------------"
#passwd dosyasini al
cp /etc/passwd $tmp_passwd
#kullanicinin sadece adi kalsin
sed -e s_:x:.*__g $tmp_passwd>$tmp_passwd_tmp ; mv $tmp_passwd_tmp $tmp_passwd
#sistem kulanicilerini yok et
for i in $sistem_users
do
sed -e s/^$i$//g $tmp_passwd>$tmp_passwd_tmp ; mv $tmp_passwd_tmp $tmp_passwd
done
#mailnull adındaki kullanici kaliyor, onu da silelim
sed -e s/^mailnull$//g $tmp_passwd>$tmp_passwd_tmp ; mv $tmp_passwd_tmp $tmp_passwd
#bos satirlari sil
sed '/^$/d' $tmp_passwd>$tmp_passwd_tmp ; mv $tmp_passwd_tmp $tmp_passwd
#islemleri yapmak uzere kullanicilari sirala
for username in `cat $tmp_passwd`
do
nokta_varmi=`echo $username |grep "\."`
if [ "$nokta_varmi" ]
then
harf=`echo $username | sed -e 's/.*\.//' | cut -c1`
else
harf=`echo $username | cut -c1`
fi
#subs dosyasinde su zorunlu kelimeler var mi
#subs dosyasi olmayanlarda olusturalim, yetkisini ayarlayalim
touch $klasor/$harf/$username/Maildir/subscriptions
chown $username $klasor/$harf/$username/Maildir/subscriptions
chgrp users $klasor/$harf/$username/Maildir/subscriptions
gidenler_var=`cat $klasor/$harf/$username/Maildir/subscriptions | grep -e Gidenler$`
taslaklar_var=`cat $klasor/$harf/$username/Maildir/subscriptions | grep -e Taslaklar$`
cop_var=`cat $klasor/$harf/$username/Maildir/subscriptions | grep -e Cop$`
#cop girdisi yoksa sorun var
if [ ! "$cop_var" ]
then
echo "$username --------------------------------------cop yoktu eklendi ----"
#subscriptions dosyasina ilgili kaydi ekle
tac $klasor/$harf/$username/Maildir/subscriptions>$subs_tmp
echo "Cop" >> $subs_tmp
tac $subs_tmp >$klasor/$harf/$username/Maildir/subscriptions
rm -f $subs_tmp
fi
#taslaklar girdisi yoksa sorun var
if [ ! "$taslaklar_var" ]
then
echo "$username --------------------------------------taslaklar yoktu eklendi ----"
#subscriptions dosyasina ilgili kaydi ekle
tac $klasor/$harf/$username/Maildir/subscriptions>$subs_tmp
echo "Taslaklar" >> $subs_tmp
tac $subs_tmp >$klasor/$harf/$username/Maildir/subscriptions
rm -f $subs_tmp
fi
#gidenler girdisi yoksa sorun var
if [ ! "$gidenler_var" ]
then
echo "$username --------------------------------------gidenler yoktu eklendi----"
#subscriptions dosyasina ilgili kaydi ekle
tac $klasor/$harf/$username/Maildir/subscriptions>$subs_tmp
echo "Gidenler" >> $subs_tmp
tac $subs_tmp >$klasor/$harf/$username/Maildir/subscriptions
rm -f $subs_tmp
fi
#hepsinin yetkisini gozden gecirelim
chmod 600 $klasor/$harf/$username/Maildir/subscriptions
#home klasorunde su zorunlu klasorler var mi, olmada olmasa da -p parametresi ile bu klasörleri yarat ve perm set et
mkdir -p $klasor/$harf/$username/Maildir/.Cop
mkdir -p $klasor/$harf/$username/Maildir/.Taslaklar
mkdir -p $klasor/$harf/$username/Maildir/.Gidenler
chmod 700 $klasor/$harf/$username/Maildir/.Cop
chmod 700 $klasor/$harf/$username/Maildir/.Taslaklar
chmod 700 $klasor/$harf/$username/Maildir/.Gidenler
chown $username $klasor/$harf/$username/Maildir/.Cop
chown $username $klasor/$harf/$username/Maildir/.Taslaklar
chown $username $klasor/$harf/$username/Maildir/.Gidenler
chgrp users $klasor/$harf/$username/Maildir/.Cop
chgrp users $klasor/$harf/$username/Maildir/.Taslaklar
chgrp users $klasor/$harf/$username/Maildir/.Gidenler
done
rm -f $tmp_passwd $tmp_passwd_tmp $subs_tmp
date; echo "BITTI ------------------------------------------------------"