Re: systemctl restart changes permission.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Thu, Apr 30, 2020 at 10:31 AM Kenneth Porter <shiva@xxxxxxxxxxxxxxx>
wrote:

> On 4/29/2020 9:06 PM, Kaushal Shriyan wrote:
> > I am running CentOS Linux release 7.8.2003 (Core)
> > with php72u-fpm-7.2.30-1.el7.ius.x86_64 version. I am facing the below
> > permission denied issue. I also did the below steps
> > #cd /run
> > #chown -Rc nginx.nginx php-fpm
> > changed ownership of ‘php-fpm/php-fpm.pid’ from root:root to nginx:nginx
> > changed ownership of ‘php-fpm’ from root:root to nginx:nginx
> > #systemctl restart php-fpm again changes it from nginx.nginx to root.root
> > user.
>
> /run is a tmpfs that gets recreated on every boot. Your permission
> changes won't persist a reboot. See here:
>
> https://lwn.net/Articles/436012/
>
> You could instead drop a systemd unit file customization file into
> /etc/systemd that changes the user that php-fpm runs as.
>
> https://www.certdepot.net/rhel-7-systemd-unit-file-customization/
> _______________________________________________
> CentOS mailing list
> CentOS@xxxxxxxxxx
> https://lists.centos.org/mailman/listinfo/centos


Hi Kenneth,

Thanks for your explanation and for pointing me to the
https://www.certdepot.net/rhel-7-systemd-unit-file-customization/ link.  I
did the following steps to fix the permission issue.

#vim /etc/systemd/system/php-fpm.service
> .include /usr/lib/systemd/system/php-fpm.service
> [Service]
> User=nginx
> Group=nginx
> #systemctl daemon-reload
> #systemctl restart php-fpm.service
> #tree -pug php-fpm
> php-fpm
> ├── [-rw-r--r-- nginx    nginx   ]  php-fpm.pid
> └── [srw-rw---- nginx    nginx   ]  www.sock


It worked like a charm. Much appreciated for your help.

Best Regards,

Kaushal
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos




[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]


  Powered by Linux