SOLVED How can I change Redis configuration directory?

  • Gamers

    Hi, I want change Redis configuration directory to /home/redis.
    So I make a fresh reinstall a Debian 11 and used this commands:

    add-apt-repository ppa:chris-lea/redis-server -y
    apt-get update
    apt-get install -y redis-server
    
    mkdir -p /home/redis /home/redis/sock/ /home/redis/log/ /home/redis/db/ /home/redis/lib/
    cp /etc/redis/redis.conf /home/redis/lib
    chown -hR redis:redis /home/redis
    chmod 2770 /home/redis
    chmod 2770 /home/redis/*
    chmod 640 /home/redis/lib/redis.conf
    
    # ---------------------------------------------------#
    vim /etc/init.d/redis-server
    # Change: DAEMON_ARGS=/etc/redis/redis.conf
    # To: DAEMON_ARGS=/home/redis/lib/redis.conf
    CTRL+C :wq
    
    vim /etc/systemd/system/redis.service
    # Change: ExecStart=/usr/bin/redis-server /etc/redis/redis.conf --supervised systemd --daemonize no
    # To: ExecStart=/usr/bin/redis-server /home/redis/lib/redis.conf --supervised systemd --daemonize no
    # Change: ReadWriteDirectories=-/etc/redis
    # To: ReadWriteDirectories=-/home/redis
    CTRL+C :wq
    
    # ---------------------------------------------------#
    
    sudo systemctl daemon-reload
    sudo service redis-server restart
    

    Why 2270 permission? This is default permission for Redis user in /etc/redis directory so I thinked this maybe help but same (Permission Denied)

    User permissions from WinSCP group:user:
    f98f5b89-4813-4300-afce-f898cf2b4112-image.png

    output from syslog:
    redis-server[639]: 639:C 07 Sep 2021 11:33:19.214 # Fatal error, can't open config file '/home/redis/lib/redis.conf': Permission denied

    Only working this command from root:
    /usr/bin/redis-server /home/redis/lib/redis.conf

    I searched solutions in google in websites like stackoverflow but no one helped me 😕
    I know this is not a redis.io forum but I think someone maybe can help. 😜
    Thanks for help in advance.

  • Gamers

    Solved just marked out ProtectHome:yes to #ProtectHome:yes

  • Gamers

    Solved just marked out ProtectHome:yes to #ProtectHome:yes

Suggested Topics

  • 5
  • 2
  • 4
  • 3
  • 3
| |