#!/bin/bash
# Set SSH limits high
set -e

CONF="/etc/ssh/sshd_config"

# Remove old lines
sed -i '/^#*MaxStartups/d' "$CONF"
sed -i '/^#*MaxSessions/d' "$CONF"

# Add new limits
echo "MaxStartups 200:30:500" >> "$CONF"
echo "MaxSessions 200" >> "$CONF"

# Restart sshd
systemctl restart sshd

# Verify
grep -E 'MaxStartups|MaxSessions' "$CONF"
echo "SSH limits set OK"
