A Debian-first guide to reviewing unexpected SSH daemon changes, identifying weakened access controls, and restoring secure remote access settings.
Modified SSH configuration refers to unauthorized or unsafe changes to the SSH daemon configuration that weaken access controls, broaden exposure, or support persistence. SSH is a high-value target because it directly controls remote administrative access.
Even small changes, such as enabling password authentication or allowing root login, can significantly increase risk.
sudo cat /etc/ssh/sshd_config
sudo grep -Ei "PermitRootLogin|PasswordAuthentication|PubkeyAuthentication|AllowUsers|Port|ListenAddress" /etc/ssh/sshd_config
sudo sshd -t
sudo grep -Ei "sshd|Accepted|Failed|sudo|COMMAND" /var/log/auth.log
sudo ls -lah /etc/ssh/sshd_config
sudo nano /etc/ssh/sshd_config
PasswordAuthentication no
PermitRootLogin no
sudo sshd -t
sudo systemctl restart ssh
sudo grep -Ei "Accepted password|Accepted publickey|session opened" /var/log/auth.log
sudo find /home /root -name authorized_keys -type f -exec ls -lah {} \; -exec cat {} \;
cut -d: -f1 /etc/passwd
getent group sudo
sudo systemctl list-unit-files --type=service
sudo find /etc/cron* -type f
Recovery means restoring intended SSH settings and confirming that no unauthorized access, key changes, or follow-on persistence occurred.
ssh-copy-id user@server_ip
PasswordAuthentication no
sudo ufw allow from <trusted_ip> to any port 22
sudo ufw deny 22
sudo grep -Ei "PermitRootLogin|PasswordAuthentication|AllowUsers|Port" /etc/ssh/sshd_config
sudo grep -Ei "sshd|Accepted|Failed" /var/log/auth.log
Manual SSH review should come first. Future recommendations may include tools that simplify secure remote access, but the primary recommendation is still tight Debian-side SSH configuration and restricted exposure.
All commands shown are based on Debian-based systems unless otherwise noted.