Ubuntu Cheat Sheet

Update all

apt-get update
apt-get upgrade
apt-get dist-upgrade
touch /etc/motd.tail
reboot now

Install MyPHPadmin

apt-get update
apt-get install php5-mcrypt
php5enmod mcrypt
apt-get install php5-curl
apt-get install phpmyadmin
service apache2 restart

if you mess up dpkg-reconfigure phpmyadmin )

add 4gb swapfile

fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
swapon -s
nano /etc/fstab
(add to bottom line)
/swapfile none swap sw 0 0

UncomplicatedFirewall (UFW)

 ufw status
 ufw allow ssh
 ufw allow http
 ufw allow https
 ufw logging on
 ufw logging medium
 ufw allow 53/udp
 ufw enable
 ufw disable

https://wiki.ubuntu.com/UncomplicatedFirewall

Disable mod_security in .htaccess (if you have some better firewall in place)

<IfModule mod_security.c>
 SecFilterEngine Off
 SecFilterScanPOST Off
</IfModule>

List running service (apt for example)

ps aux | grep -i apt

Kill by process ID

kill -9 <process id>

Kill by keyword

killall apt

Configure fail2ban for SSH

cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
nano /etc/fail2ban/jail.local
service fail2ban restart

CISSP CISM PMP