Debian – /var/run/saslauthd changing permissions on restart

chmoddebiansaslauthd

On saslsauthd restart I keep getting following permissions on /var/run/saslauthd dir:

drwx--x---

This makes e.g. Exim unable to talk to saslauthd.

If I change permissions like this:

chmod o+x /var/run/saslauthd

..Exim can talk to saslauthd again. However, as I wrote, /etc/init.d/saslauthd restart is enough to change permissions to 710 again.

I have not found anything in /etc/init.d/saslauthd script to make that happen. What's going on here?

OS: Debian 7.0.

Best Answer

Check /etc/group for this entry:

sasl:x:45:cyrus,Debian-exim

The directory /var/run/saslauthd should be owned by group sasl. Adding Exim to the sasl group should do the trick.

A little more background on the /var/run directory.

/var/run is used to store helper files for daemons. These are processes running in the background. Most prominent use is to store the pid of a daemon process. This makes it easier for the associated start/stop scripts to send a kill signal when trying to stop those processes. You may already sense that the data in /var/run is very volatile. Thus, this directory is emptied on every reboot.

saslauthd is creating such runtime information on its own startup. And it ensures to create the directory with the access rights expected by saslauthd.

An excerpt from the saslauthd init script:

    # If there is a statoverride for the run directory, then pull
    # permission and ownership information from it and create the directory.
    # Otherwise, we create the directory with default permissions and
    # ownership (root:sasl, 710).
    if dpkg-statoverride --list $RUN_DIR > /dev/null; then
            createdir `dpkg-statoverride --list $RUN_DIR`
    else
            createdir root sasl 710 $RUN_DIR
    fi

It seems it is even possible to allow a different owner and access mode for the saslauth directory through dpkg-statoverride. But I am not familiar with that and would not recommend such action. Adding exim to the sasl group is the right thing to do.