Fixing Permissions of Valiases

5/5 - (8 votes)

I wrote this 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

Update: cPanel now has a script to allow you to do this, but there are mixed reports on whether it actually works:

/scripts/fixvaliases

Leave a Reply

Your email address will not be published. Required fields are marked *

Log in