Linux
Replace default root email address
echo "root: my.email@address.com" >> /etc/aliases
newaliases
Monitor your user cron-jobs
cat /var/spool/cron/crontabs/*
Configure Automatic security updates
apt-get install cron-apt unattended-upgrades
dpkg-reconfigure unattended-upgrades
Add MariaDB Repository
MariaDB 10.1
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=10.1 --skip-maxscale
MariaDB 10.2
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=10.2 --skip-maxscale
MariaDB 10.3
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=10.2 --skip-maxscale
Backup a database with mysqldump
With a normal user :
mysqldump -u youruser -p database_name > database_dump.sql
With root user :
mysqldump database_name > database_dump.sql
Optimize all your databases
mysqlcheck -Aos
Fix SNMPD[XXXX]: ERROR ON SUBCONTAINER ‘IA_ADDR’ INSERT (-1)
sed -i 's/Lsd/LS6d/g' /etc/default/snmpd
service snmpd restart
Optimize your images with jpegoptim and optipng
Install jpegoptim and optipng
apt update && apt install jpegoptim optipng -y
JPG optimization
cd /path/to/your/image/folder
find . -iname "*.jp*" -print0 | xargs -0 jpegoptim --strip-all -m76
PNG optimization
cd /path/to/your/image/folder
find . -iname '*.png' -print0 | xargs -0 optipng -o7 -preserve
Limit CPU usage per process
Install cpulimit
sudo apt-get install cpulimit -y
Find the process PID : example with mysql
ps aux | grep mysql
Limit MySQL max CPU usage to 50%
cpulimit -p 147 -l 50 -b
EasyEngine
[EE] Block Nginx upgrade on Debian 8 Jessie
sudo apt-mark hold nginx-ee nginx-custom nginx-common
[EE] Update EasyEngine Repository PHP Key
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 3050AC3CD2AE6F03
[EE] Fix phpmyadmin error
Install Composer
bash <(wget --no-check-certificate -O - https://git.virtubox.net/virtubox/debian-config/raw/master/composer.sh)
Update phpmyadmin
sudo -u www-data composer update -d /var/www/22222/htdocs/db/pma/
[EE] Solution : couldn’t extract wordpress archive
sudo wp --allow-root cli update --nightly
WordPress
Fix WordPress files and folders permissions
cd /path/to/wordpress/folder
find -type d -exec chmod 750 {} \;
find -type f -exec chmod 640 {} \;
Edit WordPress site address
mysql -u wordpress-db-user -p -e "USE wordpress_db_name; UPDATE wp_options SET option_value='https://new-wordpress-url.ldt/' WHERE option_name='siteurl' OR option_name='home';"
Analyse wordpress site security with wp-scan
docker run -it --rm wpscanteam/wpscan -u https://yourwebsite.tld
Check website PHP7 compatibility with php7cc
docker run -it --rm -v $(pwd):/app ypereirareis/php7cc php7cc ./folder-to-scan