Current time: 04-26-2024, 04:09 PM Hello There, Guest! (LoginRegister)


Post Reply 
[HowTo] Receive an eMail during a SSH login
Author Message
BeNe Offline
Moderator
*****
Moderators

Posts: 5,899
Joined: Jan 2007
Reputation: 68
Post: #1
[HowTo] Receive an eMail during a SSH login
This is only a one line code, but sometimes very helpful and interesting.
You will recieve an eMail from the Server in seconds if someone login via SSH.
A not invited guest has no more chance Wink

Just add this line under Debian to your "/etc/bash.bashrc"

Code:
# Generate e-Mail on Login
echo 'Login on' `hostname` `date` `who`| mail -s "Login on `hostname` who | awk '{print $5}'`" YOUR@E-MAILADRESS.TLD
Please put all the code (from the echo to your eMailadress) in one line!

I´m sure this works also on other Linux distributions if you know the correct systemwide "bashrc"

Greez BeNe
06-21-2010 05:41 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
[HowTo] Receive an eMail during a SSH login - BeNe - 06-21-2010 05:41 PM

Forum Jump:


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