cpanel server changing /tmp permissions during upcp to clamav / 711

This was an odd one. I found a few servers which had their /tmp permissions changed to user clamav with permissions 711.

Turned out clamav home was set to /tmp causing this during an upcp. A which script to check / fix


tmpcheck='cat /etc/passwd | grep ^clamav: | cut -d: -f6';
echo "Warning /tmp set as homedir for user clamav";
if [ "$tmpcheck" = "/tmp" ]; then
if [ ! -e /usr/local/clamav ]; then
mkdir -p /usr/local/clamav
chown clamav:clamav /usr/local/clamav
usermod -d /usr/local/clamav clamav
else
echo '/usr/local/clamav already exists, no changes made';
fi
fi

This will create clamav home as /usr/local/clamav, only if it does not exist already. Another option may be /home/clamav

One thought on “cpanel server changing /tmp permissions during upcp to clamav / 711”

Leave a Reply

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