You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

16 lines
508 B

#!/bin/bash
# This won't be executed if keys already exist (i.e. from a volume)
ssh-keygen -A
# Copy authorized keys from ENV variable
echo "$AUTHORIZED_KEYS" >$AUTHORIZED_KEYS_FILE
groupmod --non-unique --gid "$GROUPID" data
usermod --non-unique --home "$DATADIR" --uid "$USERID" --gid "$GROUPID" "$OWNER"
# Chown data folder (if mounted as a volume for the first time)
chown "${OWNER}:data" "$DATADIR"
chown "${OWNER}:data" $AUTHORIZED_KEYS_FILE
# Run sshd on container start
exec /usr/sbin/sshd -D -e