LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   problem with mail command (https://www.linuxquestions.org/questions/linux-newbie-8/problem-with-mail-command-698092/)

hopefull 01-18-2009 05:48 AM

problem with mail command
 
I have a problem with command mail

On my lInux box i have two user: root amd test_user

When in a root shell i type mail, i have:

No mail for root

But there are at least cron mail!

If i type mail in a test_user shell, i see also root mail!

How is possible this? How i can configure mail correctly?

Thanks
bye

colucix 01-18-2009 05:56 AM

First thing to check is the user's details. When you create a user through the graphical tool, one of the options usually is "Receive System Mail" or something similar. Also check the MAILTO variable set in /etc/crontab and see if it points to test_user.

hopefull 01-18-2009 06:05 AM

In /etc/crontab file MAILTO is not present so cron mails are sent only to root

The problem is that i can't read this (and other) mails from shell root

Instead from test_user shell i can read all mails, also when in TO there is only root

For use details, i have not seen nothing of strange from GUI tool; are there conf file to check?

Thanks
Bye

colucix 01-18-2009 06:29 AM

What about checking /var/log/mail? It should report about every mail activity and tell if messages to root are forwarded to a local user for some reason. Please provide other useful information about the OS running on your machine (you can put this on your LQ profile, so we can see it in the box on the right of your posts) and the mail service. If in doubt try the following command to find out:
Code:

netstat -anp | grep LISTEN | grep :25
to see which process is listening on port 25 (mail) on the localhost.

Moreover, have you tried to send a mail to root from test_user's command line? Is it correctly received?

hopefull 01-18-2009 06:54 AM

I put info on my os in my LQ profile, however is Debian etch -4.0

The process listening on port 25 is exim4

I have sent a mail to root from user_test and also in this case the mail is readable from user_test shell and not from the root one, in which i have: No mail for root

In my mail.log file i have only rows as:

Jan 18 14:33:01 localhost sa-exim[7287]: Removed 0 of 0 greylist tuplets in 0 seconds
Jan 18 14:33:01 localhost sa-exim[7287]: Removed 0 of 0 greylist directories in 0 seconds

colucix 01-18-2009 07:32 AM

Ok. Maybe I'm wrong but it does not look like a mail problem, in the sense the mail service works and it probably acts following some "hidden" configuration. Another thing that comes in my mind (since mails are re-directed to the local user) is the presence of a .forward (hidden) file in root's home.

Regarding the crontab issue, not all systems send cron mails on a regular basis. On Fedora you will get a "Log Watch" mail every day, whereas on OpenSuse you get... nothing. I don't know about Debian. Anyway, even if Debian sends mail to root, they are forwarded to the local user in this case.

hopefull 01-18-2009 08:23 AM

Ok
In fact it is not a problem about mail daemon, but mail configuration
With your suggestion, i have seen for forward rules, so i have found in /etc/aliases the entry:

root:user_test

present for security issue.Cut this entry, i can read mail from mail shell with type
mail -u mail

also this for secrity issue, because mail to root are delevered to mail user

Thanks
bye


All times are GMT -5. The time now is 07:02 AM.