Category: Linux

Simple SSH bruteforce prevention using iptables

Since I like to learn more about scripting, I decided to write my own SSH bruteforce prevention script instead of installing a plug-and-play tool. You can run the script manually or have it run every hour or so using crontab. As root, create a new directory for the script and files, name it for example […]

hpacucli not detecting HP Smart Array Controller

In some cases hpacucli is not detecting the HP Smart Array Controller, in my case it was a HP P420 controller. => ctrl all show Error: No controllers detected. => You can solve this issue by loading the sg module: # modprobe sg You’ll see now that the controller is detected: => ctrl all show […]

MySQL crashing during startup

I just had a server on which I was not able to start MySQL. The MySQL error log shows the following: 121121 18:30:13 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 121121 18:30:13 [Note] Plugin ‘FEDERATED’ is disabled. 121121 18:30:13  InnoDB: Initializing buffer pool, size = 8.0M 121121 18:30:13  InnoDB: Completed initialization of buffer pool […]

Solution for ip_conntrack: table full, dropping packet.

Today, I was working on a brand new  (apache) server, hosting a website with 3000 concurrent visitors. The load on the server was very low while the website was dropping network connections. I ran dmesg and the following message was repeating over and over: ip_conntrack: table full, dropping packet.   It seems that ip_conntrack keeps […]

Monitoring I/O on Linux

You can use iostat to find out disk utilization, but with iotop you can monitor the actual read/write. iotop watches the I/O usage information output by the kernel and displays it in a table of current I/O usage by processes. iotop syntax for monitoring I/O usage -o Will only show processes or threads which are […]

Spamassassin: Block / blacklist an e-mail address

I am running Postfix on my Debian Linux server and using spamassassin to detect spam e-mails. However sometimes you just want to block all incoming e-mail from a domain name or e-mail address. With option ‘blacklist_from‘ in spamassassin this is very simple and useful. Locate your spamassassin configuration file and open it with your text […]

PHP: Fatal error: Allowed memory size of xx bytes exhausted (tried to allocate xx bytes)

When you see the following error message it means that the PHP script is exceeding the memory limit which is set for PHP. Fatal error: Allowed memory size of xx bytes exhausted (tried to allocate xx bytes) in /path/to/script.php To change the memory limit for one specific script, add the following line at the top […]

Monitoring server load on Linux

I wrote a simple bash script to monitor the server load, once the server load reaches the threshold it will send out an e-mail. Once you have received an e-mail from this monitoring script, you have to reset the $fileCHECK file to ‘0’: # echo ‘0’ >  $fileCHECK # In this example script it should […]

WARNING: mismatch_cnt is not 0 on /dev/md1

Since a couple of days I have seen the following message on (CentOS) servers: WARNING: mismatch_cnt is not 0 on /dev/md1 I have Googled some around, posted on forums, but couldn’t find the cause of this. Anyways, I managed to fix it with a workaround: # echo repair >/sys/block/md1/md/sync_action # wait a bit …. # echo […]

Difficulties with setting up your network in Ubuntu

Today I had some problems with setting up the network in Ubuntu. Restarting the network resulted in the following error message: # /etc/init.d/networking restart * Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces * Reconfiguring network interfaces… /etc/network/if-up.d/upstart: 43: cannot create /run/network/ifup.eth0: Directory nonexistent run-parts: /etc/network/if-up.d/upstart exited with return code […]