Go Back   Linux Forums by TotalPenguin! Get linux Help! > Linux > Linux Security

Linux Security Make your Linux box more secure - Learn How

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-11-2007, 04:21 PM
Member
 
Join Date: Jan 2007
Posts: 62
Crop is on a distinguished road
Default Receive email on login

When someone logs on as root how can I receive an email? Is there a logon script of sorts that I could run it in?
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 05-28-2007, 09:37 PM
Jordan's Avatar
Administrator
 
Join Date: Nov 2006
Posts: 572
Jordan will become famous soon enough
Default

You can a command to your .bashrc script - use the sendmail command.
Reply With Quote
  #3 (permalink)  
Old 05-28-2007, 10:09 PM
ptt3
Guest
 
Posts: n/a
Default

Here is the command for it (to execute from .bashrc):

$ /usr/sbin/sendmail email@address &ltl email.txt

Where email.txt is the email file you want to send as the message.
Reply With Quote
  #4 (permalink)  
Old 10-07-2007, 02:25 PM
TotalPenguin's Avatar
Administrator
 
Join Date: May 2007
Posts: 470
TotalPenguin will become famous soon enoughTotalPenguin will become famous soon enough
Default

Hell, is it that simple to send an email from Linux? Wow..amazing! But what will be the email address that will be displayed as received from? I mean the email address that it was sent from?
__________________
Business Directory
Technology Blog
Reply With Quote
  #5 (permalink)  
Old 10-12-2007, 04:37 AM
powerspike
Guest
 
Posts: n/a
Default

you can even go an easier route.

in the .bashrc file do something like
Code:
mail -s "Root Login" <email address>
if you log in as root, and type in export
you can see the varibles that are set in the shell, one of them should be the remote ip address
i can't remember the varible off the top of my head
but if on the command like put in $VARIBLENAME it'll print the contents out, so you could also do something like
Code:
mail -s "$VARIBLE1 has logged in as root" <email address>
there's many ways to skin a cat as they say.
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 10-12-2007, 02:06 PM
Jordan's Avatar
Administrator
 
Join Date: Nov 2006
Posts: 572
Jordan will become famous soon enough
Default

Nice post and great idea powerspike. That variable for SSH is

Code:
SSH_CLIENT
which has an output of "::ffff:10.225.66.192 2438 22"
Reply With Quote
  #7 (permalink)  
Old 10-14-2007, 09:13 AM
powerspike
Guest
 
Posts: n/a
Default

that one is IPv6 Forumat, but you can see from that, the ip address (IPv4) is 10.225.66.192 (that's a private ip adress space - so jordan was testing it on a local network =). 2438 will be the source connection port (from the machine that made the connection) and 22 is the destination port, 22 in this case is ssh =)
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 09:10 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.