#!/bin/bash
#######################
## openwebmail-fix.sh
## by Thomas Chung <tchung@openwebmail.org>
## This script fixes permission and ownership of openwebmail files
## See 'TEST' in http://www.openwebmail.org/openwebmail/doc/readme.txt

if [ $UID != "0" ]; then
  echo "Run it as root"
  exit 1
fi

OWM="/var/www/cgi-bin/openwebmail"
chown root.mail $OWM/openwebmail*.pl
chmod 4775      $OWM/openwebmail*.pl
chown root.mail $OWM/vacation.pl
chmod 0755      $OWM/vacation.pl
chown root.mail $OWM/etc
chmod 755 	$OWM/etc
chown root.mail $OWM/etc/sessions
chmod 771 	$OWM/etc/sessions
chown root.mail $OWM/etc/users
chmod 771 	$OWM/etc/users
touch 		/var/log/openwebmail.log
chown root.mail /var/log/openwebmail.log
chmod 660       /var/log/openwebmail.log
echo "Permission and Ownership for openwebmail files have been fixed!"
