LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 754|回复: 1

postfix添加與?際有結合的如何寫呢?

[复制链接]
发表于 2005-7-17 21:07:37 | 显示全部楼层 |阅读模式
[root@shlinux cd]# useradd -g mis -d /home/samba/sp02008 -s /bin/false sp02008
[root@shlinux cd]# smbpasswd -a sp02008
New SMB password:
Retype new SMB password:
[root@shlinux cd]# passwd sp02008
Changing password for user sp02008.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
(此處密碼與工號一樣就可以了)
[root@shlinux cd]# edquota -p sp02001 sp02008
[root@shlinux cd]# echo "sp02008 peter008@abcale.com" >> /etc/postfix/sender_canonical
[root@shlinux cd]# echo "peter008@abcale.com sp02008" >> /etc/postfix/recipient_canonical
[root@shlinux root]# cat /etc/postfix/newmail | mail -s "NewMail-Topic" sp02008




以上是添加新的賬號的方法.
刪除請用
userdel -r sp02008
sed -e "/sp02008/d" /etc/postfix/sender_canonical > hello ;mv -f hello  /etc/postfix/sender_canonical
sed -e "/sp02008/d" /etc/postfix/recipient_canonical > hello ; mv -f hello /etc/postfix/recipient_canonical


postfixtool -a id group name
postfixtool -d id

不知道postfixtool腳本如何編寫呢?
 楼主| 发表于 2005-7-18 11:57:00 | 显示全部楼层
[root@shlinux www]# cat /sbin/postfixtool
if [ $1 = `` ] ; then
man postfixtool ;
exit
fi
if [ $1 = "-d" ]; then
userdel -r $2
sed -e "/$2/d" /etc/postfix/sender_canonical > sender ;
sed -e "/$2/d" /etc/postfix/recipient_canonical > recipient ;
mv -f sender /etc/postfix/sender_canonical ;
mv -f recipient /etc/postfix/recipient_canonical ;
echo "over!"
exit
fi
cat /etc/group | grep $3 | cut -d ":" -f1 > /tmp/0
gid01=$(du -s /tmp/0 |cut -c1)
if [ $gid01 = 0 ]; then
        echo "Error,gid $3 is not already exist !"
        exit ;
fi
# rm /tmp/0
findid=$(cat /etc/passwd | grep $2 | cut -d ":" -f1)
if [ $findid  <> "$2" ]; then
        echo "Error ,uid $2 is already exist!"
        exit ;
fi

findname=$(cat /etc/postfix/recipient_canonical | grep $4 | cut -d "@" -f1)
if [ $findname  = "$4" ]; then
        echo "Error,$4 is already exist,change name,please!"
        exit ;
else
        echo "$2 $4@at-scale.com" >> /etc/postfix/sender_canonical
        echo "$4@at-scale.com $2" >> /etc/postfix/recipient_canonical
fi
if [ $1 = "-a" ]; then
useradd -g $3 -d /home/samba/$2 -s /bin/false $2
edquota -p sp02001 $2;
smbpasswd -a $2;
passwd $2;
cat /etc/postfix/newmail | mail -s "New Mail inform" $4
elif [ $1 = "-d" ] ; then
echo ""
else
   echo "Option Error!!"
   echo "lease,man postfixtool"
        exit ;
fi
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表