- Build the container via
docker-compose build
- Boot the container via
docker-compose up
-
Go to
localhost
in your browser to see the app landing page. -
Go to
localhost/
to see the upload files by group. -
Connect to the server via
sftp
to test connection.
sftp -P 22 group_b@localhost
# verify server fingerprint
# enter group b's password as seen in the sftp/users.conf file
- Duplicate the example sftp/users.conf.example file and edit as desired.
cp sftp/users.conf.example sftp/users.conf
nano sftp/users.conf
- Generate a ed25519 and rsa key files via:
ssh-keygen -t ed25519 -f sftp/ssh_host_ed25519_key < /dev/null
ssh-keygen -t rsa -b 4096 -f sftp/ssh_host_rsa_key < /dev/null
- You can generate a fingerprint for a public key using ssh-keygen like so:
# sha256 fingerprint
ssh-keygen -lf sftp/ssh_host_ed25519_key.pub > files/sha256-server-fingerprint.txt
# or md5 fingerprint
ssh-keygen -l -E md5 -f sftp/ssh_host_ed25519_key.pub > files/md5-server-fingerprint.txt
-
(optional) Auto-load public keys for a specific user by adding the key to the
sftp/keys_by_user
folder. The format iskeys_by_user/user-name/.ssh/keys/id_ed25519_key.pub
, as seen in thesftp/keys_by_user/example_user
folder. -
Boot the app via
docker-compose up -d --build
-
(optional) For passwordless login, load public ssh keys for a given user via:
Only needed if you didn't auto-load the keys earlier.
container_id=$(docker ps -q --filter name="sftp")
docker cp ~/.ssh/id_ed25519.pub $container_id:/tmp/
docker-compose exec sftp bash
# inside the container
# create an .ssh director owned by root
user="group_a"
uid="$(id -u "$user")"
user_ssh_folder="/home/$user/.ssh"
mkdir -p "$user_ssh_folder"
# add key to the authorized keys file and set owner to appropriate user
user_authorized_keys_file="$user_ssh_folder/authorized_keys"
cat "/tmp/id_ed25519.pub" >> "$user_authorized_keys_file"
chown "$uid" "$user_authorized_keys_file"
chmod 600 "$user_authorized_keys_file"
- Set up an example .ssh/config.
Host weather-transfer-files
HostName some-host-name
USER group_a
Port 22