Skip to content

mkdir: cannot create directory ‘/backups/daily/ even running mkdir and chown #57

@quevon24

Description

@quevon24

Hi, I followed the readme and tried to run commands to create the directory to store the backups with this:

# for default images (debian)
mkdir -p /var/opt/pgbackups && chown -R 999:999 /var/opt/pgbackups
# for alpine images
mkdir -p /var/opt/pgbackups && chown -R 70:70 /var/opt/pgbackups

When I run the commands I neet to do it with sudo to make it work, because if don't it throws this error: chown: changing ownership of '/var/opt/pgbackups': Operation not permitted and mkdir: cannot create directory ‘/var/opt/pgbackups’: Permission denied

I don't have postgresql on host, only on container but even running those commands it keeps saying :

2021/07/22 03:39:23 443 cmd: /backup.sh
2021/07/22 03:39:23 443: mkdir: cannot create directory ‘/backups/daily/’
2021/07/22 03:39:23 443: : Permission denied
mkdir: cannot create directory ‘/backups/weekly/’: Permission denied
2021/07/22 03:39:23 443: mkdir: cannot create directory ‘/backups/monthly/’: Permission denied
2021/07/22 03:39:23 443 Exit Status: 1

I'm using a VPS with ubuntu 20.04, Docker version 20.10.7 build f0df350, docker-compose version 1.25.0

I also ran docker-compose exec db /bin/bash and inside it I got uid 70 and gid 70 for postgres user/group but even assignin those uid and gid keeps throwing permission denied. I'm missing a step?

Running ls on /var/opt/pgbackups:

drwxr-xr-x 2 70 70 4096 Jul 22 14:41 pgbackups

Running id postgres on docker-compose -f docker-compose.prod.yml exec db /bin/bash:

uid=70(postgres) gid=70(postgres) groups=70(postgres),70(postgres)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions