DEV Community

Faruk
Faruk

Posted on • Originally published at Medium

Why I Set Email Alerts for Every New User Added to My Linux Server (And How You Can Too) | by Faruk Ahmed | Jul, 2025

Member-only story

Why I Set Email Alerts for Every New User Added to My Linux Server (And How You Can Too)

--

Share

Intro: New users being added to a server may seem harmless — especially if you’re managing it solo. But on a shared or internet-facing server, this can be the first sign of a breach. I learned this the hard way after noticing strange sudo activity from a user I never created. Here’s how I now monitor all user creations and how you can set up real-time email alerts on both Ubuntu and Red Hat.

  1. Why You Should Care About New Users

A newly created user with sudo access can:

  • Install malware
  • Pivot into lateral movement
  • Hide activity using rootkits

Even without sudo, attackers use fake users for persistence — so catching it early is key.

  1. Monitor /etc/passwd in Real Time Using auditd

Install auditd:

# Ubuntusudo apt install auditd -y
Enter fullscreen mode Exit fullscreen mode
# Red Hatsudo yum install audit -y
Enter fullscreen mode Exit fullscreen mode

Create an audit rule:

sudo auditctl -w /etc/passwd -p wa -k useradd-watch
Enter fullscreen mode Exit fullscreen mode

This tells the system to watch for writes/appends to /etc/passwd.


👉 Read Full Blog on Medium Here

Heroku

Save time with this productivity hack.

See how Heroku MCP Server connects tools like Cursor to Heroku, so you can build, deploy, and manage apps—right from your editor.

Learn More

Top comments (0)

Heroku

Save time with this productivity hack.

See how Heroku MCP Server connects tools like Cursor to Heroku, so you can build, deploy, and manage apps—right from your editor.

Learn More

👋 Kindness is contagious

Explore this practical breakdown on DEV’s open platform, where developers from every background come together to push boundaries. No matter your experience, your viewpoint enriches the conversation.

Dropping a simple “thank you” or question in the comments goes a long way in supporting authors—your feedback helps ideas evolve.

At DEV, shared discovery drives progress and builds lasting bonds. If this post resonated, a quick nod of appreciation can make all the difference.

Okay