Tell me more ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to receive email when people login to my server via ssh (as a security measure), however, when I login, I get:

No mail for root

Email is something@gmail.com

Does it need Postfix to work? I already install it on server but i haven't configured it

Can you give me a tutorial to configure Postfix in case it needed? Will email be sent even if my domain hasn't been propagated yet?

I added this in .bash_profile

echo 'ALERT - Root Shell Access on:' `date` `who` | 
  mail -s "Alert: Root Access from `who | awk '{print $6}'`" something@gmail.com 
share|improve this question
You will not need postfix to send an email. Sendmail should do. Are you running a script to parse the secure log and send you an email if there is an ssh connection? – Chida Aug 12 '12 at 8:12
I added more info in thread please look – Werulz Aug 12 '12 at 9:49
What happens if you run mail -s "Test" something@gmail.com manually? Any errors in /var/log/syslog, /var/log/mail.log and /var/log/mail.err? Do you have SMTP configured? – grs Aug 12 '12 at 19:07

closed as not constructive by Tom O'Connor, John Gardeniers, MadHatter, MDMarra, Michael Hampton Nov 12 '12 at 17:02

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance.

1 Answer

Well, since you are sending this email to an account on gmail, it's quite normal your system report no received emails for root. You are not sending emails to the root account but to gmail.

share|improve this answer
.......even i though same as you but i don't recieve an email .I checked both inbox and spam folder – Werulz Aug 12 '12 at 14:45
1  
Then you are doing something wrong, check your /var/log/mail.err and /var/log/mail.log – Lucas Kauffman Aug 12 '12 at 14:56

Not the answer you're looking for? Browse other questions tagged or ask your own question.