How to save iptables persistently – easy way

Save current iptables settings using command iptables-save. We save it to /etc/network/iptables.v4.rules iptables-save > /etc/network/iptables.v4.rules Last we configure our box to restore it upon booting up the network interface. Configure your network interface file /etc/network/interfaces nano /etc/network/interfaces #under iface eth0 inet static .... pre-up iptables-restore < /etc/network/iptables.v4.rules tadaaa! short and...

Redirect www to non-www nginx configuration

Redirect single domain with www to non-www. For example, redirecting of http://www.dennylabs.com to http://dennylabs.com. Why do we need to redirect www to non-www or vice versa? It all because of SEO purposes. Google treats your content as duplicate when they are crawl-able from both www and non-www. Nginx configuration for single domain redirection of www to non-www . server { server_name www.dennylabs.com; return 301 $scheme://dennylabs.com$request_uri; } Nginx configuration for multiple domains redirection of www to non-www. server { server_name "~^www\.(.*)$" ; return 301 $scheme://$1$request_uri;...

iptables remove rules using –line-numbers

List the rules for a specific chain. Example below list the “fail2ban-ssh-ddos” chain. iptables -L fail2ban-ssh-ddos --line-numbers Example output: Chain fail2ban-ssh-ddos (2 references) num target prot opt source destination 1 REJECT all -- 192.0.0.8 anywhere reject-with icmp-port-unreachable 2 RETURN all -- anywhere anywhere Delete rule line number 1: iptables -D fail2ban-ssh-ddos...

Installing Pure-FTPd on Ubuntu 12.04

Guide wrote on 13 Jan 2014 Step 1) Install Pure-FTPd using aptitude package tool root@server:~# aptitude -y install pure-ftpd Step 2) Run pure-ftpd as a daemon (background process) root@server:~# echo "yes" > /etc/pure-ftpd/conf/Daemonize Step 3) Disable anonymous ftp login root@server:~# echo "yes" > /etc/pure-ftpd/conf/NoAnonymous Step 4) Jail all local user to their home directories root@server:~# echo "yes" > /etc/pure-ftpd/conf/ChrootEveryone Step 5) Configure FTP server to use IPv4 only root@server:~# echo "yes" > /etc/pure-ftpd/conf/IPV4Only Last Step) Restart pure-FTP server for changes to take effect root@server:~# service pure-ftpd restart Optional configurations you may need: Defining passive ports (passive port range 21000 to 21100 in example below) root@server:~# echo "21000 21100" > /etc/pure-ftpd/conf/PassivePortRange Set maximum number of clients (50 clients in example below) root@server:~# echo "50" >...