Sign inSign up

guergolet/sftp

By guergolet

Updated about 6 years ago

SFTP Server running into a container, using public keys to authenticate

Image
Networking
0

198

guergolet/sftp repository overview

SFTP Server

Every time I need to configure an SFTP Server, I find many details related to different Linux distribution and details.

This project allows the sysadmins to run an SFTP Server into a container using some basic features like:

  • Choose the SFTP Port;
  • Use a priv/pub key to login;
  • Configure users into a JSON file;
  • Limit max connections for each user;

File Structure

  • users.json: Sample configuration file with two test users (the private keys are available into sample_data folder. It could be mapped to your users.json file.

  • ./home: Sample home folder. This folder must be mapped outside the container (to a local folder or docker volume);

  • ./sample_data: Sample public and private keys

Building the Container

sudo docker build . -t sftp

Running the Container

sudo docker run --rm --name sftp -p 22000:22000 --privileged -v $(pwd)/home:/home -v $(pwd)/users.json:/app/users.json sftp

Snippets

ssh-keygen

When the command above ask about filename, I suggest to create the file in current folder and set the username. This command will output two files: [username] and [username.pub]

Into users.json insert into pubkey user attribute the [username.pub] file content.

To connect to your SFTP Server: sftp -i [username] -P 22000 [username]@localhost

Tag summary

Content type

Image

Digest

Size

8 MB

Last updated

about 6 years ago

docker pull guergolet/sftp