docs / linux / monitor-fail2ban
monitor + fail2ban
ubuntu / debian
for DEBIAN make sure rsyslog is installed and running :
apt install rsyslog
systemctl enable –now rsyslog
.systemctl status rsyslog
Configure SSH Logging
Edit the SSH configuration to ensure proper logging:
nano /etc/ssh/sshd_config
Add or uncomment these lines:
textcopy
SyslogFacility AUTH
LogLevel INFO# Check if screen is installed
textcopy
screen --version # If not installed, install it
textcopy
apt update apt install screen
# Create a named screen session for the IP monitor
textcopy
screen -S monitor# Now you’re inside the screen session
# Navigate to your script location and run it
textcopy
cd /root textcopy
./monitor.shtextcopy
To detach from the screen session (leave it running in background):- Press
Ctrl+A, then pressD - You’ll see:
[detached from 12345.ip-monitor]
Direct Background Launch
# Start the script directly in a detached screen session
screen -dmS monitor /root/monitor.sh