CentOS7: How do disable PrivateTmp for Apache with systemd?

Technically better to provide a small override of service file rather than copying the whole new version in /etc/systemd/system … (www.freedesktop.org/software/systemd/man/systemd.unit.html)

mkdir /etc/systemd/system/httpd.service.d
echo "[Service]" >  /etc/systemd/system/httpd.service.d/nopt.conf
echo "PrivateTmp=false" >> /etc/systemd/system/httpd.service.d/nopt.conf


# systemctl daemon-reload
# systemctl cat httpd.service

# /usr/lib/systemd/system/httpd.service
Description=The Apache HTTP Server
After=network.target remote-fs.target nss-lookup.target

ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND
ExecReload=/usr/sbin/httpd $OPTIONS -k graceful
ExecStop=/bin/kill -WINCH ${MAINPID}
# We want systemd to give httpd some time to finish gracefully, but still want
# it to kill httpd after TimeoutStopSec if something went wrong during the
# graceful stop. Normally, Systemd sends SIGTERM signal right after the
# ExecStop, which would kill httpd. We are sending useless SIGCONT here to give
# httpd time to finish.


# /etc/systemd/system/httpd.service.d/nopt.conf
PrivateTmp=false  --------------------------------------------- THIS

# systemctl restart httpd.sevice

Leave a Reply

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


Scroll to top