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.
18 lines
721 B
18 lines
721 B
#!/bin/bash |
|
|
|
# This won't be executed if keys already exist (i.e. from a volume) |
|
|
|
[ ! -f /etc/ssh/host_keys/ssh_host_ecdsa_key ] && ssh-keygen -t ecdsa -f /etc/ssh/host_keys/ssh_host_ecdsa_key |
|
[ ! -f /etc/ssh/host_keys/ssh_host_ed25519_key ] && ssh-keygen -t ed25519 -f /etc/ssh/host_keys/ssh_host_ed25519_key |
|
|
|
# Copy authorized keys from ENV variable |
|
echo "$AUTHORIZED_KEYS" > $AUTHORIZED_KEYS_FILE |
|
|
|
groupmod --non-unique --gid "$GROUPID" data |
|
usermod --non-unique --uid "$USERID" --gid "$GROUPID" data |
|
# Chown data folder (if mounted as a volume for the first time) |
|
chown -R "${USERID}:${GROUPID}" "/home/data" |
|
chown "${USERID}:${GROUPID}" $AUTHORIZED_KEYS_FILE |
|
|
|
# Run sshd on container start |
|
exec /usr/sbin/sshd -D -e
|
|
|