From cd5d03295a84282224908f639c350928caa925a3 Mon Sep 17 00:00:00 2001 From: Adrian Dvergsdal Date: Sat, 8 Aug 2020 16:00:09 +0200 Subject: [PATCH] Change host key permission to 600 and avoid error See https://github.com/atmoz/sftp/commit/4e4726aaa28fb4e5cf163be14ace94dcf0ac9769#commitcomment-41292709 --- files/entrypoint | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/files/entrypoint b/files/entrypoint index 16d2270..9c3d6e3 100755 --- a/files/entrypoint +++ b/files/entrypoint @@ -67,14 +67,14 @@ if [ ! -f "$userConfFinalPath" ]; then # Generate unique ssh keys for this container, if needed if [ ! -f /etc/ssh/ssh_host_ed25519_key ]; then ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N '' - else - chmod 700 /etc/ssh/ssh_host_ed25519_key fi if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then ssh-keygen -t rsa -b 4096 -f /etc/ssh/ssh_host_rsa_key -N '' - else - chmod 700 /etc/ssh/ssh_host_rsa_key fi + + # Restrict access from other users + chmod 600 /etc/ssh/ssh_host_ed25519_key || true + chmod 600 /etc/ssh/ssh_host_rsa_key || true fi # Source custom scripts, if any