FTP rights alpine-ftp and wordpress

Hello,

I am using Coolify on my VPS, using Docker to run a Wordpress multisite.

I can access my wordpress files by running an alpine ftp server. But I don’t have the correct rights to add or modify some files. I prefer not changing the folder rights, to avoid any issue with updates and uploads on the wordpress backoffice.

I am pretty sure it can me managed on my Dockerfile, but I didn’t figure how.

Maybe can I get a little help here ?

Thanks in advance

services:
  wordpress:
    image: 'wordpress:latest'
    volumes:
      - 'wordpress-files:/var/www/html'
    environment:
      - SERVICE_FQDN_WORDPRESS
      - WORDPRESS_DB_HOST=mysql
      - WORDPRESS_DB_USER=$SERVICE_USER_WORDPRESS
      - WORDPRESS_DB_PASSWORD=$SERVICE_PASSWORD_WORDPRESS
      - WORDPRESS_DB_NAME=wordpress
    depends_on:
      - mysql
    healthcheck:
      test:
        - CMD
        - curl
        - '-f'
        - 'http://127.0.0.1'
      interval: 2s
      timeout: 10s
      retries: 10
  mysql:
    image: 'mysql:8'
    volumes:
      - 'mysql-data:/var/lib/mysql'
    environment:
      - MYSQL_ROOT_PASSWORD=$SERVICE_PASSWORD_ROOT
      - MYSQL_DATABASE=wordpress
      - MYSQL_USER=$SERVICE_USER_WORDPRESS
      - MYSQL_PASSWORD=$SERVICE_PASSWORD_WORDPRESS
    healthcheck:
      test:
        - CMD
        - mysqladmin
        - ping
        - '-h'
        - 127.0.0.1
      interval: 5s
      timeout: 20s
      retries: 10
  pma:
    image: phpmyadmin/phpmyadmin
    depends_on:
      - mysql
    ports:
      - '8070:80'
    environment:
      - PMA_HOST=mysql
      - MYSQL_ROOT_PASSWORD=$MYSQL_PASSWORD_ROOT
  ftp:
    image: delfer/alpine-ftp-server
    network_mode: host
    ports:
      - '21:21'
      - '21000-21010:21000-21010'
    environment:
      - USERS=graphandco|mypassword|/var/www/html
    volumes:
      - 'wordpress-files:/var/www/html'

You are missing the uid:gid setting.

It should look something like this:

      - USERS=graphandco|mypassword|/var/www/html|<user id>

or

      - USERS=graphandco|mypassword|/var/www/html|<user id>|<group id>

Of course, and are placeholders for the real ids.
You should be able to docker exec into the wordpress container and execute ps auxf to figure out which user is used to execute the main process. Then execute id <name of the user> to get the uid and gid. Replace the placeholders with those values, then redeploy your compose project.

Thanks for feeding back.

I tried

- USERS=graphandco|mypassword|/var/www/html|33|33
- USERS=graphandco|mypassword|/var/www/html|33
- USERS=graphandco|mypassword|/var/www/html|0|0
- USERS=graphandco|mypassword|/var/www/html|0

I can’t even connect to the FTP, login incorrect. mypassword does not have to match any other password like root or www-data, right ?

I just looked into the Docker Hub description and saw that it allows setting uid and gid for the user.
Apart from that I never used that image and can’t tell you how it actually works.

If you want to know more about the image, you can raise an issue in the GItHub project where the image is maintained: https://github.com/delfer/docker-alpine-ftp-server/issues

Update: there is one more thing that caught my attention. You must configure this as well:

    - ADDRESS=ftp.site.domain

Make sure the url resolves to an ip that allows reaching the docker host form the internet. This is basic passive ftp knowledge: the client will receive this ip to establish the data connections.