User talk:Aaronjs

Sometimes I log into shell and I do weird things late at night, and I don't recall doing them the next day. Then, I nearly have a heart attack when I accidentally scroll through my recent shell commands and see commands I don't remember typing.

So, I decided I would set a mouse trap on my shell login to trigger some action -- say an e-mail.

Here is what I had to do:

Use nano to create a file called .bash_profile in my user home /home/yourusername

create a tmp directory COMMAND: mkdir tmp

create the bash profile file COMMAND: nano .bash_profile

in that file, append: SUBJECT="Someone Just Logged Into the shell!" EMAIL="emailaddress@where.you.wantitto.go" EMAILMESSAGE="/home/ /tmp/emailmessage.txt" echo "Just a warning that someone logged into your bash shell from IP :" > $EMAILMESSAGE echo $SSH_CLIENT >> $EMAILMESSAGE /usr/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE

Save the file and you'll get an e-mail whenever someone logs into shell as that user...