LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Mail as Root? (https://www.linuxquestions.org/questions/linux-general-1/mail-as-root-317372/)

carlosinfl 04-26-2005 01:18 PM

Mail as Root?
 
For some reason I can't understand how this works or how to rid of this from my system.

My Linux server gets mail as root (seems to be system generated).

The location is shows from is /var/spool/mail/root": 112 messages 112 new

My question is how do I remove the email and how do I stop the email from coming?

Code:

>N  1 root@server.carlwill  Sat Feb 12 15:10  41/1325  "Invalid File Contexts"
 N  2 root@server.carlwill  Sun Feb 13 01:28 141/4050  "LogWatch for server.carlwill.com"
 N  3 root@server.carlwill  Mon Feb 14 04:02 133/5310  "LogWatch for server.carlwill.com"
 N  4 root@server.carlwill  Mon Feb 14 04:02  25/941  "Cron <root@server> run-parts /etc/cron.daily"
 N  5 root@server.carlwill  Tue Feb 15 04:02 206/9365  "LogWatch for server.carlwill.com"

The help menu says:

Code:

Mail  Commands
t <message list>                type messages
n                              goto and type next message
e <message list>                edit messages
f <message list>                give head lines of messages
d <message list>                delete messages
s <message list> file          append messages to file
u <message list>                undelete messages
R <message list>                reply to message senders
r <message list>                reply to message senders and all recipients
pre <message list>              make messages go back to /usr/spool/mail
m <user list>                  mail to specific users
q                              quit, saving unresolved messages in mbox
x                              quit, do not remove system mailbox
h                              print out active message headers
!                              shell escape
cd [directory]                  chdir to directory or home if none given

A <message list> consists of integers, ranges of same, or user names separated
by spaces.  If omitted, Mail uses the last message typed.

A <user list> consists of user names or aliases separated by spaces.
Aliases are defined in .mailrc in your home directory.

What does the command look like to remove the mail? I can't figure this out... :confused:

Donboy 04-26-2005 01:50 PM

Several of those messages are being generated by LogWatch, which is probably running from your cron.daily. Just go into /etc/cron.daily and move that Logwatch script to another place... maybe /root. I actually recommend having these emails delivered to a remote address.. maybe your regular mailbox. Just go into /etc/crontab and right near the top, you should see MAIL=root or something similar. Just change it to MAIL=you@yourdomain.com and these emails will be sent to an external mailbox. These logwatch reports are actually very good for seeing whats' happening on your system in a nice daily format. I don't recommend shutting these off completely. They could possibly alert you to hack attempts.

Boow 04-26-2005 01:51 PM

I haven't read to much on mail but you can delete mail like this.

? d 1 2 3 4 5
?q

Some distros save it in $HOME/mail after its read I dont know how to set that up right now.

carlosinfl 04-26-2005 01:56 PM

So I will need to press

d 1 2 3 4 5 .... all the way to 120???

Is there a fast and quick way to delete them all or a bulk amount of them?

Boow 04-26-2005 02:09 PM

Try d 1-120

kees-jan 04-27-2005 04:50 AM

I suggest typing
Code:

rm /var/spool/mail/root
in a shell.

Groetjes,

Kees-Jan


All times are GMT -5. The time now is 07:30 PM.