Table of Contents

Host an SFTP Server

Share on facebook
Share on twitter
Share on telegram
Share on linkedin
Share on whatsapp
Share on reddit
Share on email

Transfer Data to a SFTP Server with Docker

For more information visit GitHub or DockerHub.

Introduction

If you want to upload files to your server and access them from inside you might want to set up SFTP.

SFTP is the more secure version of FTP.

If you want to install an FTP Server on your Raspberry Pi click here.

 

1. Installation

1.1 Create the Docker-Compose File

First create a new folder and cd into it.

mkdir ftp && cd ftp

Create a docker-compose file.

nano docker-compose.yml

And paste this:

version: '3'
services:
  sftp:
    container_name: sftp_server
    image: atmoz/sftp
    volumes:
      - ./users.conf:/etc/sftp/users.conf:ro
      - ./home:/home
    ports:
      - "2222:22"

1.2 Creating Users

Now create a new file called “users.conf”

nano users.conf

And paste your user data:

username:password:1001:100

The format is as follows:

user:password:uid:gid

If you want to use an encrypted password add “:e” after the encrypted password.

user:encryptedpassword:e:uid:gid

Now spin up the container:

docker-compose up -d

1.3 Creating writable directories

Now cd into the home directory of your user:

cd home/username

In here we’ll have to create a new directory.

This is going to be the only directory we can write to.

mkdir files

To make this folder writable, execute this command:

chmod 756 files

 

2. Connecting to your Server

Download FileZilla.

Connect to your server like this:

Sftp Server on Docker with Filezilla

Related Post
minecraft

How to host a Forge Server

Playing Minecraft with Mods on a Docker hosted Minecraft Server.
Ads

Comments

0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x