Posts

Showing posts with the label google

Send photo to email when entering wrong password

Step 1 : Prerequisites installation (Optional if available) ffmpeg (Photo app) s-nail  (Mail app) For more ways to take picture refer this article . $ sudo apt update $ sudo apt install ffmpeg s-nail Step 2 : Create App password from google account Check this to create app passwords. Step 3 : Change the email and password(App password) in the script Create file sudo nano /usr/local/bin/takepic filename=`date +%s` ffmpeg -f video4linux2 -s vga -i /dev/video0 -vframes 1 /tmp/$filename.jpg echo ' ALERT Usage detected:'  `date` `who` | s-nail -a /tmp/$filename -S smtp-use-starttls -S ssl-verify=ignore -S smtp-auth=login -S smtp=smtp://smtp.gmail.com:587 -S from=" username @gmail.com" -S smtp-auth-user=username@gmail.com -S smtp-auth-password= ashalkshalkhsbzxn -S ssl-verify=ignore  -s "LOGIN ALERT" -v " tousername @gmail.com" exit 0  Save and close. $ sudo chmod +x /usr/local/bin/takepic Step 4 : Change the pam.d Backup the original file $ sudo cp...

How to send mail from terminal in Ubuntu

Image
There are multiple ways to send mail. Postfix is one of them.  Step 1: Install Postfix  $ sudo apt update $ sudo apt install postfix Select Internet site.  Next, You can type any domain here. we can change it later. Step 2: Save Gmail password Create a new file $ sudo nano /etc/postfix/gpasswd     [smtp.gmail.com]:587 username@gmail.com:password Step 3: Configure postfix $ sudo nano /etc/postfix/main.cf Add or update the properties smtp_use_tls = yes smtp_sasl_auth_enable = yes smtp_sasl_security_options = smtp_sasl_password_maps = hash:/etc/postfix/gpasswd smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt $ sudo postmap /etc/postfix/gpasswd $ sudo systemctl restart postfix  mail -s "Subn" username@gmail.com CC: Enter the message Press Ctrl + D to send message. That's it folks.

Two step verification for SSH using Google authentication in 3 simple steps

Image
    Google Authenticator (GA) Google authenticator is a tool which generate 6 digits Time-based One Time Password(TOTP) for authentication which supports authenticator service(GA, Authy, ..).     Step 1 : Install Google authenticator  $ sudo apt update $ sudo apt install libpam-google-authenticator   Step 2 : Configure Google authenticator $ google-authenticator     time based authentication - y   Scan code using google authenticator ios or android app or type in the secret key ** Copy the emergency scratch codes Next type ( y )   Type ( y ) to prevent man-in-the-middle attack Type ( n ) Type ( y ) for rate limiting ** If detailed explanation is required please comment. I will make another post with detailed explanation.   Step 3 : Configure ssh $ sudo nano /etc/pam.d/sshd Add the following line to last line of the file auth required pam_google_authenticator.so   $ sudo nano /etc/ssh/sshd_config Find and Replace ChallengeRespo...