DEV Community

leroykayanda
leroykayanda

Posted on • Edited on

Setting up an SFTP server on Linux

docker-compose.yaml

version: '3'
services:
 sftp:
   image: atmoz/sftp
   volumes:
     - ./users.conf:/etc/sftp/users.conf:ro
     - ./sftp/uploads/harry:/home/harry
     - ./sftp/uploads/john:/home/john
   ports:
     - "2222:22"
Enter fullscreen mode Exit fullscreen mode

users.conf

harry:secret:::uploads
john:pass:::uploads
Enter fullscreen mode Exit fullscreen mode

An uploads folder will be created in each user directory e.g /home/harry/uploads. Uploads need to be done in this directory as the /home/harry directory is owned by root and the user will not have permissions to upload items there.

References
https://hub.docker.com/r/atmoz/sftp

https://github.com/atmoz/sftp/issues/16

Top comments (0)