How to Clear Large Root System Emails on CWP / AlmaLinux Server

Περισσότερα
1 Εβδομάδα 20 Ώρες πριν #344 από infogate
Hello,

I wanted to share a quick server maintenance fix in case it helps someone else using CWP / Control Web Panel on AlmaLinux / CentOS.

On my server, I noticed that system emails for the Linux root user had become very large.

I checked the root mailbox size with:
ls -lh /var/mail/root

In my case, the result was:
-rw------- 1 root mail 1.5G Jul 1 03:23 /var/mail/root

This means the local system mailbox for the root user had grown to 1.5GB.

This mailbox is used for local server notifications from cron jobs, CWP scripts, backup jobs, security tools, and other system processes.

The problem was that new system emails were bouncing with an error similar to this:
cannot update mailbox /var/mail/root for user root. error writing message: File too large

So important server alerts could be lost.

To clear the root system mailbox safely, I used:
: > /var/mail/root

Then I checked the file size again:
ls -lh /var/mail/root

The result was:
-rw------- 1 root mail 0 Jul 1 09:43 /var/mail/root

This cleared the mailbox successfully.

Important note:
: > /var/mail/root

This command empties the file but keeps the file itself and its permissions.

Do not delete the file with:
rm -f /var/mail/root

Deleting it is not recommended because it may later be recreated with wrong permissions.

This action does not delete hosted email accounts, Roundcube emails, domain emails, or client mailboxes.

It only clears the local Linux system mailbox for the root user:
/var/mail/root

If you want to keep a small record before clearing it, you can save the last lines first:
tail -n 1000 /var/mail/root > /root/root-mail-last-1000-lines.txt
: > /var/mail/root
ls -lh /var/mail/root /root/root-mail-last-1000-lines.txt

After clearing it, you may also want to redirect root emails to a real email address.

Edit or update the aliases file:
grep -q "^root:" /etc/aliases && sed -i 's/^root:.*/root: [email protected]/' /etc/aliases || echo "root: [email protected]" >> /etc/aliases
newaliases

Replace this:

with your real admin email address.

After that, future root/system emails should be forwarded to your email instead of piling up locally.

Summary of the quick fix:
ls -lh /var/mail/root
: > /var/mail/root
ls -lh /var/mail/root

This is a simple but useful cleanup when the local root mailbox becomes too large and system notifications start bouncing.


The best possible way to start your online marketing : fspirits.com/go/leadsleap-home
Explode Your Web Site Traffice: fspirits.com/go/sparktraffic
Start your affiliate journey here: fspirits.com/go/olsp-academy
Best Solution To Create Videos: fspirits.com/go/create-studio-pro
Best Solution To Create Graphics: fspirits.com/go/clickdesigns
Smart Chat Automation: fspirits.com/go/chatterpal
Multi-Purpose Video Maker: fspirits.com/go/avatar-builder
Multi-Purpose Video Creator: fspirits.com/go/video-creator
AI Human Spokesperson Videos: fspirits.com/go/humanpal

Παρακαλούμε Σύνδεση ή Δημιουργία λογαριασμού για να συμμετάσχετε στη συζήτηση.

Χρόνος δημιουργίας σελίδας: 0.059 δευτερόλεπτα
Powered by Kunena Φόρουμ