How To Downgrade PIP After Upgrade on Amazon Linux

Author: , March 25th, 2020

I tried upgrading pip when prompted to do so: sudo pip install –upgrade pip This worked, but removed the system install in /usr/bin/pip and replaced it with /usr/local/bin/pip – NOT GOOD! The solution is as follows:

How To Show the Origin in Git

Author: , January 30th, 2020

Recently, I wanted to see the “origin” of the git repository I was working in. The command is: git remote -v For example:

How To Block All Traffic From China Using iptables and ipset on Amazon Linux

Author: , October 24th, 2019

All credit to Matt Wilcox for this excellent article, for which this post is based – thank you, Matt! https://mattwilcox.net/web-development/unexpected-ddos-blocking-china-with-ipset-and-iptables/ All commands run as root!

Do this once only:

Then add blockchina to the root cron

How To Upgrade PHP on AWS Linux

Author: , August 22nd, 2019

As root:

~or~

THEN:

Be sure to restart your web server!!

How To Obtain a Public Key from an AWS .pem Private Key on Linux and Mac

Author: , February 4th, 2019

Use the ssh-keygen command on a computer to which you’ve downloaded your private key .pem file; for example: First, ensure permissions will allow ssh-keygen to work: chmod 600 /path/to/the/file/your-key-pair.pem Then generate an RSA public key: ssh-keygen -y -f /path/to/the/file/your-key-pair.pem > your-key-pair.pub

How To Move Around in Linux CLI Mail

Author: , May 7th, 2018

h Shows you a screenful of message headers (a “header” being the number, sender, date, size and subject). h with no message number shows the current screenful of messages (the number that make up a screenful is set with the screen variable, described below). h$ shows you the last screenful of messages — which is […]

How To Locate Attached Disk Devices in Linux

Author: , April 24th, 2018

https://linux.die.net/man/8/lsblk # lsblk -a

How To Reduce the Size of a PDF Using Ghostscript

Author: , February 4th, 2017

Make sure you have Ghostscript installed, then:

-dPDFSETTINGS={value} where {value} is one of: /screen – the lowest resolution and lowest file size, fine for viewing on a screen /ebook – mid-range resolution and file size /printer – high-quality setting used for printing PDFs /prepress – high-quality setting used for printing PDFs As always, YMMV…

How To Enable Legacy Key Type Support in SSH 7

Author: , December 9th, 2016

Recently I had to launch an Ubuntu instance in AWS because i needed to run alien to convert a .rpm into a .deb package. When I added my SSH keys as usual, I found I was still unable to login. This is the error from the /var/log/auth.log file: Dec 9 16:47:55 localhost sshd[1550]: userauth_pubkey: key […]

How To Block an Entire TLD in Postfix

Author: , September 13th, 2016

Step 1. Execute the following two commands: postconf -e smtpd_sender_restrictions=pcre:/etc/postfix/rejected_domains postconf -e reject_unauth_destinations=pcre:/etc/postfix/rejected_domains If that doesn’t work, you may hand-edit main.cf and add/edit these lines:

Step 2. Create the regex filter file: vim /etc/postfix/rejected_domains

Step 3. Signal Postfix to reread the config: postfix reload NOTE: Do NOT use the postmap command for the […]