LoginSignup
11
15

More than 5 years have passed since last update.

CentOS7のhttpdはそのままだと(mod_php経由などで) /tmpに書き込もうとすると実は別のディレクトリに書き込まれる

Last updated at Posted at 2016-09-14

これはSystemdのPrivateTmpという機能が有効になっているからですね。

PrivateTmp

Systemdで管理しているサービスにおいて /tmp/var/tmp をサービスごとに作るための機能です。

(セキュリティの面から共有しそうなファイルシステムを分離するためだと思います。)

具体的にどこに保存されるかというと

/tmp/systemd-private-xxxxx-httpd.service-xxxx/tmp/

になります。

このPrivateTmpがデフォルトでOnになっているため上記のような現象が発生します。

解除する方法

PrivateTmpをOffにすれば良いです。

# mkdir /etc/systemd/system/httpd.service.d
# echo "[Service]" >  /etc/systemd/system/httpd.service.d/privatetmp.conf
# echo "PrivateTmp=false" >> /etc/systemd/system/httpd.service.d/privatetmp.conf
# systemctl daemon-reload
# systemctl restart httpd

できればOffにせずに運用したいですね。

参考URL

http://enakai00.hatenablog.com/entry/20130917/1379374797
http://upwork.link/apache2/centos7-how-do-disable-privatetmp-for-apache-with-systemd/

11
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
15