Add check for existing SSH config file before creation

This commit is contained in:
gyurix
2025-07-21 14:28:12 +02:00
parent addca92fe7
commit 4513397b07

View File

@@ -36,8 +36,9 @@ for key_type in rsa ed25519; do
fi
done
if [ -f $SSH_CONFIG_FILE ]; then
cat >"$SSH_CONFIG_FILE" <<EOF
cat >"$SSH_CONFIG_FILE" <<EOF
Port $SSH_PORT
ListenAddress 0.0.0.0
HostKey $SSH_HOST_KEYS_DIR/ssh_host_rsa_key
@@ -53,6 +54,8 @@ AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
EOF
fi
chown -R $SSH_USER:$SSH_USER "/home/$SSH_USER"
# Start SSH daemon
echo "Starting SSH server on port $SSH_PORT..."