The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]

FreeBSD Support
 New Topic  |  Go to Top  |  Go to Topic  |  Search  |  Log In   Newer Topic  |  Older Topic 
 how to read root mail
Author: cbrace 
Date:   02-01-07 22:23

Hi all,

I recently installed 6.1 and I am slowly getting up to speed with it. A few times when I have logged in as root, it says "You have new mail", but when I enter "mail", it says "No mail for root". By means of "cat /var/mail/root" I can see that there are indeed some messages spooled. Why isn't the mail program displaying them?

Thanks.

--
Colin Brace
Amsterdam

Post Edited (02-01-07 17:24)

Reply To This Message
 
 Re: how to read root mail
Author: Dan 
Date:   02-01-07 22:44

Are you really logging in as root? Or logging in as your usual user and using su?

Regardless, I usually forward all mail for root to myself. An easy way to do this is /etc/mail/aliases. In there, you will find a commented out alias for root. Change it to yourself, like this:

$ grep root /etc/mail/aliases
root: dan

Then all mail for root on this machine will go to dan's account.

You could also specify dan@example.org, instead of just dan.

Depending on what mail server you are using, you need to invoke the changes you made to that file: newaliases is what you'd use on a default system. If using postfix, then postalias /etc/mail/aliases is what you want.

--
Webmaster

Reply To This Message
 
 Re: how to read root mail
Author: cbrace 
Date:   02-01-07 23:12

I've been logging into root using sudo ("sudo su"), which I installed having grown accustomed to using it under Ubuntu.

Anyway, I modified the alias as you suggested and it now works. That still leaves the messages in /var/mail/root (not important, just wondering how to fix it).

Also, is there a way of flushing the outgoing mail queue? There is a bunch of stuff sitting there from some tests with postfix.

Thanks for your assistance.

Reply To This Message
 
 Re: how to read root mail
Author: Dan 
Date:   03-01-07 00:32

cbrace wrote:

> Anyway, I modified the alias as you suggested and it now works.
> That still leaves the messages in /var/mail/root (not
> important, just wondering how to fix it).

this is a quick and dirty way, others may recommend more correct solutions:

cat /var/mail/root >> /var/mail/dan

This adds all the mail for root to dan's mailbox.

> Also, is there a way of flushing the outgoing mail queue? There
> is a bunch of stuff sitting there from some tests with postfix.

postsuper -d KKKKKKKKK

Where KKKKKKKKK is the queue id. Depending on how many items, you may want to script the removal.

--
Webmaster

Reply To This Message
 
 Re: how to read root mail
Author: cbrace 
Date:   03-01-07 02:17

As an experiment, I just added my normal account to the "wheel" group and that allowed me to log into root using su. Now mail displays the messages in the inbox. I guess there are some subtle differences between logging into root with su and sudo.

Thanks for the postsuper tip.

Reply To This Message
 
 Re: how to read root mail
Author: Jim Trigg 
Date:   19-01-07 19:25

If you want to use sudo, use "sudo -i" instead of "sudo su" -- that gets you a login shell (so the environment variables are set up right to read mail).

Reply To This Message
 
 No getting mail for root
Author: robi_cse2k 
Date:   11-08-11 06:36


when I have logged in as root in SUN PC(Solaris 10 OS),
and provide below command

bash-3.00# mail
No mail.
bash-3.00# mailx
No mail for root

bash-3.00# grep root /etc/mail/aliases
postmaster: root
bin: root
daemon: root
system: root
toor: root
uucp: root
manager: root
dumper: root
operator: root
decode: root

bash-3.00# tail -100 /var/log/syslog
bash-3.00# tail -100 /var/log/syslog.0
Aug 10 15:28:49 OLM-01 sendmail[3740]: [ID 801593 mail.info] p7A9SnQs003740: from=root, size=77, class=0, nrcpts=1, msgid=<201108100928.p7A9SnQs003740@OLM-01.>, relay=root@localhost
Aug 10 15:28:49 OLM-01 sendmail[3740]: [ID 801593 mail.info] p7A9SnQs003740: to=robi_cse2k@yahoo.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30077, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
Aug 10 15:33:47 OLM-01 sendmail[12126]: [ID 801593 mail.info] p7A9Xl3J012126: from=root, size=77, class=0, nrcpts=1, msgid=<201108100933.p7A9Xl3J012126@OLM-01.>, relay=root@localhost
Aug 10 15:33:47 OLM-01 sendmail[12126]: [ID 801593 mail.info] p7A9Xl3J012126: to=robi_cse2k@yahoo.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30077, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]

Please help me to get mail for root..



Reply To This Message
 
 Re: No getting mail for root
Author: Dan 
Date:   11-08-11 11:50

Does mail for any OTHER user get through? e.g. your login?

It looks like there is nothing listening on port 25...

--
Webmaster

Reply To This Message
 Forum List  |  Threaded View   Newer Topic  |  Older Topic 


 Forum List  |  Need a Login? Register Here 
 User Login
 User Name:
 Password:
 Remember my login:
   
 Forgot Your Password?
Enter your email address or user name below and a new password will be sent to the email address associated with your profile.
How to get the most out of the forum

phorum.org