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?
Receive email on login
Started by Crop, Mar 11 2007 07:21 AM
6 replies to this topic
#1
Posted 11 March 2007 - 07:21 AM
|
|
|
#2
Guest_Jordan_*
Posted 28 May 2007 - 12:37 PM
Guest_Jordan_*
You can a command to your .bashrc script - use the sendmail command.
#3
Guest_ptt3_*
Posted 28 May 2007 - 01:09 PM
Guest_ptt3_*
Here is the command for it (to execute from .bashrc):
$ /usr/sbin/sendmail email@address <l email.txt
Where email.txt is the email file you want to send as the message.
$ /usr/sbin/sendmail email@address <l email.txt
Where email.txt is the email file you want to send as the message.
#4
Posted 07 October 2007 - 05:25 AM
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?
#5
Guest_powerspike_*
Posted 11 October 2007 - 07:37 PM
Guest_powerspike_*
you can even go an easier route.
in the .bashrc file do something like
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
in the .bashrc file do something like
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
mail -s "$VARIBLE1 has logged in as root" <email address>there's many ways to skin a cat as they say.
#6
Guest_Jordan_*
Posted 12 October 2007 - 05:06 AM
Guest_Jordan_*
Nice post and great idea powerspike. That variable for SSH is
which has an output of "::ffff:10.225.66.192 2438 22"
SSH_CLIENT
which has an output of "::ffff:10.225.66.192 2438 22"
#7
Guest_powerspike_*
Posted 14 October 2007 - 12:13 AM
Guest_powerspike_*
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 =)


Sign In
Create Account


Back to top









