
How to Install GAU (Get All URLs) on Ubuntu 24.04: A Step-by-Step Guide
August 19, 2025Real-Time SSH Login & Logout Alerts to Discord on Kali Linux
Last verified for accuracy: September 9th, 2025
Want to know exactly when someone logs into or out of your Kali Linux server? In this quick tutorial, I’ll show you how to set up instant Discord notifications for SSH login and logout events using PAM (Pluggable Authentication Modules).

π― What You’ll Get
- β‘ Real-time monitoring – No delays or polling
- π’ Instant login notifications – Know when someone connects
- π΄ Logout tracking – See when sessions end
- π± Discord integration – Alerts sent to your Discord channel
π Prerequisites
- Kali Linux server with SSH enabled
- Discord server where you can create webhooks
- Root or sudo access to your server
- 5 minutes of your time
Step 1: Create Your Discord Webhook
First, we need to create a Discord webhook to receive our SSH notifications:
- Open your Discord server
- Navigate to Server Settings β Integrations β Webhooks
- Click “Create Webhook”
- Give it a name like “SSH Monitor”
- Choose the channel where you want notifications
- Copy the webhook URL (we’ll need this soon)
β οΈ Security Note: Treat your webhook URL like a password and don’t share it publicly!
Step 2: Create the Notification Script
Now let’s create the script that will send Discord notifications whenever someone logs in or out via SSH:
Make the script executable:
Step 3: Configure PAM to Trigger Our Script
Now we need to tell the SSH service to run our script whenever someone logs in or out. We’ll do this by editing the PAM configuration:
Find the line that says @include common-session
and add this line right after it:
Save and exit the file (Ctrl+X
, then Y
, then Enter
).
Step 4: Test Your Setup
Time to see if everything works! Open a new terminal window or use another machine to test:
You should see a π’ green notification in your Discord channel when you successfully log in.
And a π΄ red notification when you log out.
π§ Troubleshooting
Not Getting Notifications?
Check your webhook URL:
Check script permissions:
Check PAM configuration:
Getting Duplicate Messages?
If you’re seeing the same notification twice, you might have added the PAM line in the wrong place. Make sure it’s only added once, after the @include common-session
line.
π What’s Next?
Congratulations! You now have real-time SSH monitoring for your Kali Linux server. Every login and logout will be instantly reported to your Discord channel with color-coded alerts.
Want to take this further? Consider adding:
- Failed login monitoring – Catch brute force attempts
- IP geolocation – See where connections are coming from
- User-specific alerts – Different notifications for different users
- Integration with fail2ban – Automatic IP blocking
π‘ Pro Tips
- Store webhook as environment variable for better security
- Test from different IPs to ensure it captures external connections
- Set up multiple webhooks for different channels (e.g., alerts vs logs)
- Monitor your Discord channel – silence means no SSH activity!
This simple setup gives you immediate visibility into SSH access on your Kali server. Perfect for home labs, VPS monitoring, or any Linux server where you want to track access. Stay secure! π‘οΈ
Found this helpful? Share it with your fellow system administrators and let us know in the comments if you’ve enhanced this setup further!
β Ready for a reliable, high-performance VPS at an unbeatable price? We host our own Kali labs on Hostinger: 4 vCPU, NVMe storage, 16 GB RAM and 16 TB bandwidth, backed by 24/7 support and a 30-day money-back guarantee. Youβll save up to 20% when you lock in a 24-month plan. Grab a Hostinger VPS using this referral link and support our content.