Skip to content

Restricted SSH server in a Docker container which allows SCP / SFTP access only

Notifications You must be signed in to change notification settings

azrod/docker-scp-server

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-scp-server

This is a mainly unmodified fork of schoolscout/scp-server with the following changes:

  • Update alpine base image to 3.20
  • Add GithubAction to build and push the image to ghcr.io

Restricted SSH server which allows SCP / SFTP access only.

Running

  1. Put your authorized keys in an ENV variable and run the image:

Use the AUTHORIZED_KEYS_BASE64 or AUTHORIZED_KEYS_BASE64 environment variable to specify the authorized keys for the data user. The value should be a base64-encoded string of the authorized_keys file.

```bash
AUTHORIZED_KEYS_BASE64=$(base64 -w0 my-authorized-keys)

docker run -d \
  -e AUTHORIZED_KEYS_BASE64=$AUTHORIZED_KEYS_BASE64 \
  -p <PORT>:22 \
  -v <DATADIR>:/home/data \
  -v <HOSTKEYDIR>:/var/local/etc/ssh \
  ghcr.io/azrod/docker-scp-server
```

Alternatively, mount your `authorized_keys` file into the container at `/run/secrets/authorized_keys`:

```bash
docker run -d \
  -v /path/to/my/authorized_keys:/run/secrets/authorized_keys \
  -p <PORT>:22 \
  -v <DATADIR>:/home/data \
  -v <HOSTKEYDIR>:/var/local/etc/ssh \
  ghcr.io/azrod/docker-scp-server
```
  1. Now you can copy into the container (e.g. via scp) as the data user:

    scp -P <PORT> <FILE> data@<DOCKER-HOST>:

About

Restricted SSH server in a Docker container which allows SCP / SFTP access only

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • Shell 72.5%
  • Dockerfile 27.5%