Saturday, 6 November 2010

Fixing Permissions of Valiases

Tthis script a while back to fix the permissions of alias files in /etc/valiases when users were having trouble creating forwarders. You can also download the script in plaintext here.
#!/bin/bash
# Script to fix permissions of valiases
# Written by: Vanessa Vasile 5/17/10
# http://thecpaneladmin.com


for domain in `cat /etc/userdomains |awk '{print $1}' | grep -v "*" | cut -d: -f1`
do

if ! [ -f /etc/valiases/$domain ]; then
touch /etc/valiases/$domain
fi

user=$(egrep "^$domain:" /etc/userdomains |awk '{print $2}');
chown $user:mail /etc/valiases/$domain
chown $user:mail /etc/vdomainaliases/$domain
chmod 644 /etc/valiases/$domain
chmod 644 /etc/vdomainaliases/$domain
done

No comments:

Post a Comment