server

msmtp

/etc/msmtprc defaults maildomain example.net syslog LOG_MAIL aliases /etc/aliases account default host mail.example.net port 587 from srv7@example.net auth on user user@example.net password ******** tls on tls_starttls on #tls_certcheck off tls_fingerprint DB:A0:2A:07:00:F9:E3:23:7D:07:E7:52:3C:95:9D:E6:7E:12:54:3F Your alias file # /etc/aliases default: me@example.net A php script to send mail #!/usr/bin/php <?php define('TAB',"\t"); $user = $_SERVER['LOGNAME']; $host = exec("hostname -f"); $from = $user.'@'.$host; $to = 'sweety@example.net'; $subject = 'Testing msmtp'; $message = 'hello from '. $host; $headers = 'From: '.

Send mail with sendmail

#!/bin/bash SENDMAIL=/usr/sbin/sendmail RECIPIENT=tosomeone@example.com FROM=me@example.com cat <<EOF | $SENDMAIL -t ${RECIPIENT} From: ${FROM} To: ${RECIPIENT} Subject: testmail some test text as body of the email. EOF

UTF-8 Character List

Common: “ ” ‘ ’ – — … ‐ ‒ ° © ® ™ • ½ ¼ ¾ ⅓ ⅔ † ‡ µ ¢ £ € « » ♠ ♣ ♥ ♦ ¿ � Math: - × ÷ ± ∞ π ∅ ≤ ≥ ≠ ≈ ∧ ∨ ∩ ∪ ∈ ∀ ∃ ∄ ∑ ∏ ← ↑ → ↓ ↔ ↕ ↖ ↗ ↘ ↙ ↺ ↻ ⇒ ⇔

Linux Snippets

Find and chmod files or folders find . -type d -exec chmod 755 {} \; find . -type f -exec chmod 644 {} \; Find a directory and display on screen find . -type d -name 'linux' 2>/dev/null Find/Grep for a string across multiple files with different extensions find . -name "*.php" | xargs grep -niP 'thingy' find \( -name "*js" -o -name "*jsp" -o -name "*jspf" \) | xargs grep -niP 'thingy' Find and replace find .

ssh authorization

Create a public ssh key, if you haven’t one already. Look at ~/.ssh. If you see a file named id_dsa.pub then you obviously already have a public key. If not, simply create one. ssh-keygen -t dsa ItemMake sure your .ssh dir is 700: chmod 700 ~/.ssh Get your public ssh key on the server you want to login automatically. scp ~/.ssh/id_dsa.pub remoteuser@remoteserver.com: Append the contents of your public key to the ~/.

Network Safety Restart Bash Script

If you ever work on a remote servers network settings then this script may safe you from having to call support, and waiting on them. When started/executed it Sleeps first for 1 hour Then it renames the ”/etc/network/interfaces” file by adding the current time stamp to the end of the file It renames a file called ”/etc/network/interfaces.org” to ”/etc/network/interfaces” And finally it restarts the server. It also warns you a couple minutes before it does all that so you can terminate the program.

msmtp install, config and test

Why have more then one mail server? Or why even have a mail server at all, if you can use gmail? Well there are many reasons to have at leased one mail server, but having one on each server doesn’t make sense at all. I tried both ssmtp and msmtp, and decided on msmtp. msmtp is an SMTP client. In the default mode, it transmits a mail to an SMTP server, which takes care of further delivery.

git branch on bash line

This little code, if placed in to your ~/.bash_profile file will reveal what git branch you are working on. parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* (.*)/(1)/' } if [[ $EUID -ne 0 ]]; then PS1="w$(parse_git_branch) $ " fi

Linux find & replace HowTo

Find and chmod files or folders find . -type d -exec chmod 755 {} ; find . -name "*.php" | xargs grep -niP 'thingy' Find a directory and display on screen find . -type d -name 'linux' 2>/dev/null Find/Grep for a string across multiple files with different extensions find ( -name "*js" -o -name "*jsp" -o -name "*jspf" ) | xargs grep -niP 'thingy'