Current time: 04-19-2024, 06:28 PM Hello There, Guest! (LoginRegister)


Post Reply 
[HowTo] Receive an eMail during a SSH login
Author Message
c0urier Offline
Junior Member
*

Posts: 89
Joined: Jun 2007
Reputation: 1
Post: #7
RE: [HowTo] Receive an eMail during a SSH login
@schnere

If I don't remove the extra ` that is added in BeNe's example I get errors. I'm sure that extra ` should not be there.

This works for me:
WRONG:
Code:
echo 'Login on' `hostname` `date` `who`| mail -s "Login on `hostname` who | awk '{print $5}'" YOUR@E-MAILADRESS.TLD

And not:
WRONG:
Code:
echo 'Login on' `hostname` `date` `who`| mail -s "Login on `hostname` `who | awk '{print $5}'`" YOUR@E-MAILADRESS.TLD

I've added it in the profiles and correct you receive a mail at every login now, but not with the second example it just generates an error.
Tested on Debian Lenny, Debian Squeeze and CentOS 5.0.

And you are right, it has a better effect in /etc/profile - Thanks for that!

*****************
@ schnere Nr2: =)
I can see you added an extra ` which is not added in BeNe's suggestion, so the correct is as you write.
Correct:
Code:
echo 'Login on' `hostname` `date` `who`| mail -s "Login on `hostname` `who | awk '{print $5}'`" YOUR@E-MAILADRESS.TLD
(This post was last modified: 08-05-2010 01:28 AM by c0urier.)
08-05-2010 12:40 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [HowTo] Receive an eMail during a SSH login - c0urier - 08-05-2010 12:40 AM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)