If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Ravi Saive

I am Ravi Saive, creator of TecMint. A Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux. Follow Me: Twitter, Facebook and Google+

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

35 Responses

  1. Pandurang Khot says:

    Create a alert on my server such that if anyone other than my and my manager IP’s login to the server we should get an mail based alert with the user ID & ip address.

    Please help.

  2. vikash khanna says:

    Thanks a ton, after implementing I am able to get root SSH login email alerts..

  3. Tony says:

    Hi, I just tested this on my Linux box and it works well. However, if i need to reverse the script, how do i achieve that?

    echo ‘ALERT – Root Shell Access (ServerName) on:’ `date` `who` | mail -s “Alert: Root Access from `who | cut -d'(‘ -f2 | cut -d’)’ -f1`” [email protected]

  4. askoday says:

    Hello!

    I get this when attempting to install mailx the above command.

    Reading package lists ... Done
    Building the dependency tree
    Reading status information ... Done
    The mailx package is a virtual package provided by:
      mailutils 1: 3.1.1-1
      bsd-mailx 8.1.2-0.20160123cvs-4
    You must explicitly select a package to install.
    
    E: The "mailx" package does not have a version that can be installed
    

    As the message says, apt-get install mailutils works.

    Thank you for sharing your knowledge.

  5. Ravi says:

    When i am trying the command i am getting.

    line 13: unexpected EOF while looking for matching `''
    line 14: syntax error: unexpected end of file
    

    i didn’t find any solutions

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.