sftp icon indicating copy to clipboard operation
sftp copied to clipboard

Permission denied problem: trying to setup an sftp server for volumes content editing

Open digEmAll opened this issue 4 years ago • 1 comments

Hi, I'm trying to setup a docker-compose with 2 services sharing a volume plus 1 SFTP service allowing users to add/delete/edit/rename files inside that shared volume.

The two services seems to be able to work on the same volume content without any problem, while the SFTP service exposes the volumes but with readonly permission only. I tried to play with uid/gid etc. but I couldn't solve the issue.

I created an oversimplified example to reproduce my problem. Here's the docker-compose.yml :

version: "3.9"
services:
  svca:
    image: alpine:latest
    container_name: alpine-a
    command: /bin/ash -c "echo aaa >> /test/dump.txt"
    volumes:
      - sharedvol:/test
  svcb:
    image: alpine:latest
    container_name: alpine-b
    command: /bin/ash -c "echo bbb >> /test/dump.txt"
    volumes:
      - sharedvol:/test
  sftp:
    image: atmoz/sftp
    volumes:
      - sharedvol:/home/foo/inner/test
    ports:
        - "5522:22"
    command: foo:mypass:::inner
volumes:
  sharedvol:

When you docker-compose up, the first two services svca and svcb write 'aaa' and 'bbb' (respectively) on the same file dump.txt stored on the shared volume sharedvol.
The third service sftp, uses atmoz/sftp to expose to users the same shared volume, but dump.txt is not editable, but readonly.
Also it seems impossible to upload any file to any of the sftp folders, even though inner folder is a sub-folder of the home folder.

What am I doing wrong? Sorry for the noob question, but I'm stuck on this and I couldn't find any help in related issues.

digEmAll avatar Sep 16 '21 13:09 digEmAll

This one solved it for me : https://github.com/atmoz/sftp/issues/16#issuecomment-203876715

artificial-julien avatar Sep 28 '21 20:09 artificial-julien