Hostxpeed
Login Get Started →
Security

How to Get Security Reports via Email

4 min read
24 views
Jun 10, 2026

Step 1: Install Mailutils

sudo apt install mailutils -y

Step 2: Create Report Script

sudo nano /usr/local/bin/send-report.sh

Add:

#!/bin/bash
REPORT="/tmp/report.txt"
echo "Server: $(hostname)" > $REPORT
echo "Date: $(date)" >> $REPORT
echo "Failed logins: $(sudo grep 'Failed password' /var/log/auth.log | wc -l)" >> $REPORT
echo "Updates available: $(apt list --upgradable 2>/dev/null | grep -c security)" >> $REPORT
echo "Disk usage: $(df -h / | tail -1)" >> $REPORT
mail -s "Daily Security Report $(date)" admin@example.com < $REPORT

Step 3: Schedule Daily

echo "0 8 * * * /usr/local/bin/send-report.sh" | sudo crontab -

Was this article helpful?