Re: systemctl restart changes permission.

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

 





On Thu, 30 Apr 2020 at 13:53, Lennart Poettering <lennart@xxxxxxxxxxxxxx> wrote:
On Do, 30.04.20 09:35, Kaushal Shriyan (kaushalshriyan@xxxxxxxxx) wrote:
65;6001;1c
> Hi,
>
> 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.

Typically, these per-service dirs in /run/ get recreated during
restart, by the service in question. In addition, if RuntimeDirectory=
is used in the service, systemd will automatically clear the specified
directory when a service goes down. It's generally assumed to be the
job of the daemon in question to create and make sure things are
properly owned on next start if it uses different users and drops
privs on its own.

Lennart

--
Lennart Poettering, Berlin

Thanks Lennart for the reply. I have followed the below 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. Please let me know if I am missing anything or if there are any better ways to handle the same issue. I look forward to hearing from you. Thanks in advance.

Best Regards,

Kaushal
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux