# Permission denied for Redis?

**URL:** <https://help.nextcloud.com/t/permission-denied-for-redis/19806>\
**Category:** ℹ️ Support\
**Tags:** redis, nc12\
**Created:** [August 18, 2017, 6:22pm UTC](https://help.nextcloud.com/t/permission-denied-for-redis/19806 "2017-08-18T18:22:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![carlitoco](https://help.nextcloud.com/user_avatar/help.nextcloud.com/carlitoco/32/3545_2.png) [@carlitoco](https://help.nextcloud.com/u/carlitoco)\
**Post date:** [August 18, 2017, 6:22pm UTC](https://help.nextcloud.com/t/permission-denied-for-redis/19806/1 "2017-08-18T18:22:44Z")

</div>

I’ve a suspicious error, maybe you have an answer?  
{“reqId”:“xxxx”,“level”:3,“time”:“2017-08-18T19:47:23+02:00”,“remoteAddr”:“xx.xx”,“user”:“xxx”,“app”:“PHP”,“method”:“GET”,“url”:“/ocs/v2.php/apps/notifications/api/v2/notifications”,“message”:"  
Redis::connect(): connect() failed:  
Permission denied at /usr/share/webapps/nextcloud/lib/private/RedisFactory.php#82",  
“userAgent”:“Mozilla/5.0 (X11; Linux x86\_64; rv:55.0) Gecko/20100101 Firefox/55.0”,“version”:“12.0.2.0”}

I configured Redis as socket:  
/run/redis/redis.sock

ls -lah /run/redis/

drwxr-xr-x 2 redis redis 60 18. Aug 19:42 .  
drwxr-xr-x 29 root root 920 18. Aug 19:42 …  
srwx------ 1 redis redis 0 18. Aug 19:42 redis.sock

nextcloud config.php like this:  
‘memcache.local’ =\> ‘\OC\Memcache\APCu’,  
‘memcache.locking’ =\> ‘\OC\Memcache\Redis’,  
‘redis’ =\>  
array (  
‘host’ =\> ‘/run/redis/redis.sock’,  
‘port’ =\> 0,  
),

I didn’t get it! thanks for help I’m stupid now 🙂 !

---

<div class="post-metadata">

**Author:** ![tflidd](https://help.nextcloud.com/letter_avatar/tflidd/32/6_22734026db12803ebb3e059622ac3534.png) [@tflidd](https://help.nextcloud.com/u/tflidd)\
**Post date:** [August 18, 2017, 7:03pm UTC](https://help.nextcloud.com/t/permission-denied-for-redis/19806/2 "2017-08-18T19:03:02Z")

</div>

The socket must be accessible for www-data. You first have to change the chmod of the socket to 770 that the redis group can access it, make changes in `/etc/redis/redis.conf`:

`unixsocketperm 770`

and then add `www-data` to the redis group in `/etc/group`:  
`redis:x:110:www-data`

---

<div class="post-metadata">

**Author:** ![carlitoco](https://help.nextcloud.com/user_avatar/help.nextcloud.com/carlitoco/32/3545_2.png) [@carlitoco](https://help.nextcloud.com/u/carlitoco)\
**Post date:** [August 18, 2017, 7:31pm UTC](https://help.nextcloud.com/t/permission-denied-for-redis/19806/3 "2017-08-18T19:31:16Z")

</div>

okay i changed unixsocketperm my /etc/group shows redis:x:994:http

---

<div class="post-metadata">

**Author:** ![hook](https://help.nextcloud.com/user_avatar/help.nextcloud.com/hook/32/59_2.png) [@hook](https://help.nextcloud.com/u/hook)\
**Post date:** [July 2, 2018, 6:17am UTC](https://help.nextcloud.com/t/permission-denied-for-redis/19806/6 "2018-07-02T06:17:06Z")

</div>

I have the same issue and ~~haven’t managed to solve it yet either~~ have now found the solution.

The relevant part of `config/config.php` says:

```auto
  'memcache.local' => '\OC\Memcache\APCu',
 'memcache.locking' => '\OC\Memcache\Redis',
 'filelocking.enabled' => 'true',
 'redis' =>
 array (
   'host' => '/var/run/redis/redis.sock',
   'port' => 0,
   'timeout' => 0.0,
 ),
  'cache_path' => '/srv/nextcloud_data/cache',

```

and the `/etc/redis/redis.conf` says:

```auto
bind 127.0.0.1
protected-mode yes
port 0
tcp-backlog 511
unixsocket /var/run/redis/redis.sock
unixsocketperm 770
timeout 0
tcp-keepalive 300
daemonize yes
supervised no
pidfile /var/run/redis/redis-server.pid
loglevel notice
logfile /var/log/redis/redis-server.log
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /var/lib/redis
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes

```

What was missing is that I had to restart the (whole) server for Redis to start working. No idea why just restarting Redis wasn’t enough, but restarting the server solved the issue for me.

@carlitoco, does this solve your problem as well?

---

<div class="post-metadata">

**Author:** ![carlitoco](https://help.nextcloud.com/user_avatar/help.nextcloud.com/carlitoco/32/3545_2.png) [@carlitoco](https://help.nextcloud.com/u/carlitoco)\
**Post date:** [October 4, 2018, 2:34pm UTC](https://help.nextcloud.com/t/permission-denied-for-redis/19806/7 "2018-10-04T14:34:51Z")

</div>

only if I activate daemonize its not working anymore…

---

<div class="post-metadata">

**Author:** ![system](https://help.nextcloud.com/user_avatar/help.nextcloud.com/system/32/29333_2.png) [@system](https://help.nextcloud.com/u/system)\
**Post date:** [September 23, 2024, 5:44pm UTC](https://help.nextcloud.com/t/permission-denied-for-redis/19806/8 "2024-09-23T17:44:32Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 9, 2024, 1:32pm UTC](https://help.nextcloud.com/t/permission-denied-for-redis/19806/9 "2024-12-09T13:32:23Z")

</div>


