emberstack/docker-sftp

FTP user permissions vs. web server user permissions

aldorr opened this issue · 2 comments

aldorr commented

I have setup my sftp container to map a folder which is shared with a web server docker image. This works well.
On the web server, the users:group is www-data:www-data (duh).
Would there be a configure my sftp container (with different username:usergroup) to be able to write to the directories and files which currently have www-data permissions, while still keeping those permission (allowing my Joomla installation in the other container to still have write access)?
I've been changing permissions back and forth to allow devs to check in their code, and then back to www-data permissions so Joomla can make changes, do updates, etc. I'd like to not have to do this.
Thanks a heap for any help!

aldorr commented

This is how I got it to work, so both systems have r/w access:
Set UID & GUID of the FTP user to 33 (www-data, usually).
Is there a "better" way?

aldorr commented

To be more specific, here is the config.ftp.json:

{
    "Global": {
        "Chroot": {
            "Directory": "%h",
            "StartPath": "html"
        }
    },
    "Users": [
        {
            "Username": "username",
            "Password": "super-secret-passw0rd",
            "UID": "33",
            "GID": "33"
        }
    ]
}

& docker-compose.yml

version: "3"

services:
  sftp:
    image: "emberstack/sftp"

Hope this helps someone... and if I'm hugely mistaken about this, please let me know.
    ports:
      - "22"
    volumes:
      - ./config.sftp.json:/app/config/sftp.json:ro
      - /path/to/files/on/local:/home/username/html
    restart: unless-stopped

Hope this helps someone, someday... and if I'm hugely mistaken, please let me know.
Thanks!