How to send email on user login in ubuntu


Step 1: Go to your gmail account.

Step 2: Click Manage your Google Account.

Manage your account

  Step 3: Go to Security.


 Step 4: Click App Passwords (Check 2 - step verification  is ON).


 Step 5: Select App as Mail and Device as other(type anything) and click GENERATE.


Step 6: Copy the generated key in the yellow box
 

Step 7: Update the following command with your details(frommail, tomail, copied passcode).

echo ' ALERT - Root Shell Access on:'  `date` `who` | s-nail -S 
smtp-use-starttls -S ssl-verify=ignore -S smtp-auth=login -S 
smtp=smtp://smtp.gmail.com:587 -S from="frommail" -S 
smtp-auth-user=frommail -S smtp-auth-password=passcode -S 
ssl-verify=ignore  -s "LOGIN ALERT" -v "tomail"

Step 8: Open .bashrc

nano .bashrc

Step 9: Paste the command in step 7 in last line of the file and save it.  That's it!


Comments

Popular posts from this blog

How to install MRTG on UBUNTU

How to install Apache Tomcat in Ubuntu

How to mine cryptocurrency using unMineable