S
S
Sergey Pugovkin2020-08-18 02:34:37
linux
Sergey Pugovkin, 2020-08-18 02:34:37

Why such magic with file permissions?

su -s /bin/bash www-data
php -r 'echo shell_exec("whoami"); var_dump(is_readable("/run/redis/redis.sock"), is_writable("/run/redis/redis.sock"), is_executable("/run/redis/redis.sock"));'

Outputs: www-data bool(true) bool(true) bool(true)

index.php via nginx (php-fpm)
<?php
echo shell_exec("whoami");
var_dump(is_readable("/run/redis/redis.sock"), is_writable("/run/redis/redis.sock"), is_executable("/run/redis/redis.sock"));

Outputs: www-data bool(false) bool(false) bool(false)

How can this be?

PS:
/run/redis - owner of redis:redis, permissions - 2755
/run/redis/redis.sock - owner of redis:redis, permissions - 770
www-data - www-data (main group), redis (additional group).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
nokimaro, 2020-08-20
@Driver86

I understand that you added an additional group to the www-data user?
and write permissions appeared in the shell, but not in fpm?
Then for starters I would try doing restart fpm and restart nginx

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question