Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Tuesday, January 9, 2024

How to send a command line mail by mutt with a gmail account?

Mutt is an open-source, text-based email client used in command-line interfaces. Known for its simplicity, flexibility, and powerful features, it supports various email protocols like IMAP and POP3.

Sending emails is an indispensable requirement for an application developer or system administrator. After Google disabled the less secure mail setting, the scripts I used to send emails using Gmail accounts stopped working.

By activating the 2FA (Two-Factor Authentication) feature in your Gmail account and defining an App, you can still use your scripts to send emails by using the password you set for this app.

The steps you need to follow for this solution are outlined below.

Steps:

--

1. Enable MFA

2. Define App Password

3. Install Mutt

4. Example Config:

set from = "aliokan@gmail.com"
set realname = "KALE - Server"
#set imap_user = "aliokan@gmail.com"
#set imap_pass = "myverysecretpassword"

set smtp_url = "smtp://aliokan@smtp.gmail.com:587/"
set smtp_pass = "myverysecretpassword"
set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set ssl_starttls = yes
set ssl_force_tls = yes

## Opsiyonel: E-postaları yerel olarak saklamak için
#set header_cache = ~/.mutt/cache/headers
#set message_cachedir = ~/.mutt/cache/bodies
#set certificate_file = ~/.mutt/certificates 

Test:

# echo "Bu bir test mesajıdır." | mutt -s "Test Konusu" targetmail@gmail.com

Possible error message:

No authenticators available
Could not send the message.

Solution:

# yum -y install cyrus-sasl-plain


(Platform: CentOS Linux release 7.9.2009 (Core))

Wednesday, August 17, 2022

Get IP count stats for syslog traffic

 tcpdump -nns0 -i any -c 100000 dst port 514 |awk '{print $3}' |cut -d. -f1-4 |sort -V |uniq -c |sort -n

Sunday, January 23, 2022

Saturday, December 11, 2021

Create bootable Windows 11 iso on Ubuntu 20.04

 ❯ sudo dd bs=4M if=/mnt/hgfs/Ddd/Win11_English_x64v1.iso of=/dev/sdc conv=fdatasync  status=progress

Sunday, December 20, 2020

Linux phones

An Open Source Smart Phone Supported by All Major Linux Phone Projects

https://www.pine64.org/pinephone/

 A Security and Privacy Focused PhoneThe Librem 5 represents the opportunity for you to take back control and protect your private information, your digital life through free and open source software, open governance, and transparency.

https://puri.sm/products/librem-5/

Friday, June 19, 2020

how systemd works?

systemd is 10 years old, but feelings about it in the Linux community haven’t mellowed—it’s as divisive now as it ever was. Although it’s used by many major Linux distributions, the hardcore opposition hasn’t relented.

https://www.howtogeek.com/675569/why-linuxs-systemd-is-still-divisive-after-all-these-years/

Saturday, June 6, 2020

allow http/https by using firewall-cmd on RHEL 7


[root@server ~]# firewall-cmd --get-active-zones
public
  interfaces: eth0




firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload

Saturday, May 30, 2020

Tuning vim for yaml file modifications

When vi detects that you are editing a YAML file, it performs a 2-space indentation when you press the Tab key and autoindents subsequent lines.

 $HOME/.vimrc file:
autocmd FileType yaml setlocal ai ts=2 sw=2 et

Monday, December 9, 2019

Tuesday, July 30, 2019

Merge multipe pdf files in single pdf file

pdfunite - Portable Document Format (PDF) page merger

$ pdfunite 1.pdf 2.pdf 3.pdf 4.pdf 5.pdf 6.pdf 7.pdf application.pdf

http://manpages.ubuntu.com/manpages/bionic/man1/pdfunite.1.html


Wednesday, June 5, 2019

How to install CA certificates in Ubuntu server

https://www.techrepublic.com/article/how-to-install-ca-certificates-in-ubuntu-server/#ftag=RSS56d97e7

Tuesday, June 4, 2019

Convert file encoding: Turkish character saving problem

Turkish character saving problem

Solution:
 
$ file -i input.file
$ cat input.file 
$ iconv -f ISO-8859-1 -t UTF-8//TRANSLIT input.file -o out.file
$ cat out.file 
$ file -i out.file 

Tuesday, May 1, 2018

curl Command Resume Broken Download

curl -C - url
OR
curl -L -O -C - url
OR
curl -L -o 'filename-here' -C - url

Friday, September 29, 2017

Wednesday, August 16, 2017

Linux sistemin ping response dönüşünü engelleme

Aşağıdaki iptables komutu ile bunu gerçekleştirebilirsiniz.

iptables -I INPUT -p icmp --icmp-type echo-request -j REJECT

Friday, November 18, 2016

xargs usage

xargs can also be used to parallelize operations with the -P maxprocs argument to specify how many parallel processes should be used to execute the commands over the input argument lists. However, the output streams may not be synchronized. This can be overcome by using an --output file argument where possible, and then combining the results after processing. The following example queues 24 processes and waits on each to finish before launching another.

find /path -name '*.foo' | xargs -P 24 -I '{}' /cpu/bound/process '{}' -o '{}'.out

https://en.wikipedia.org/wiki/Xargs






Thursday, November 3, 2016

Linux Security Administrator's Guide


general overview of security issues that face the administrator of Linux systems. It covers general security philosophy and a number of specific examples of how to better secure your Linux system from intruders. Also included are pointers to security related material and programs.

www.linuxsecurity.com/docs/SecurityAdminGuide/SecurityAdminGuide.html

Friday, October 14, 2016

linux: mac spoof nasıl yapılır

* Spoof the MAC address:

sudo ifconfig en1 ether [mac address to spoof]

Where it says "[mac address to spoof]", press Command-V to paste the victim's, er, I mean the machine-to-be-spoofed's MAC address.  Your machine may require an administrator password at this point.  This is the password you use to log into OS X on your own machine.

* Confirm the spoof:

ifconfig en1 | grep ether

Your displayed MAC address should now be different from what it was before.

command line external ip information

$ curl ipinfo.io

Return IP information about your external ip address with JSON format