Fixing Permissions of Valiases

Fixing Permissions of Valiases
5 (100%) 7 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

Don't be selfish, share!Tweet about this on TwitterShare on RedditShare on TumblrBuffer this pageDigg thisShare on FacebookFlattr the authorEmail this to someoneShare on Google+Pin on PinterestPrint this pageShare on LinkedInShare on StumbleUpon

Leave a Reply

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

Log in