How to remove VirtFS like a boss

Like a bossRecently I was unfortunate to witness huge filesystem loop on a cPanel server that was caused by combination of VirtFS and Idera's Server Backup software (previously known as R1soft CDP backup). To cut the chase, I had to disable and remove VirtFS for all users on the server. cPanel has documented how to do this on their wiki, but they failed to mention couple of very important things that will help you not to destroy your server.

So, cPanel provided us with nice little script that can unmount orphaned VirtFS mounts. The script is located at /scripts/clear_orphaned_virtfs_mounts and you can get to know it better if you run it with --help switch. Running the script with no arguments will simply unmount obsolete VirtFS mounts (e.g. for terminated account), but if you have to remove VirtFS for an account that is still active, you will have to take a different approach.


Fixing timeout between Nginx and PHP-FPM

SysadminIn case you've set up Nginx as reverse proxy for PHP-FPM and you have very slow or complex PHP script that executes for quite some time, you've probably seen an 504 gateway time-out error. This is pretty common error, but in most cases people are barking at the wrong tree and they're having difficulties finding out which timeout directive is the right one for their scenario.

I've seen some people desperately experimenting with proxy_read_timeout, send_timeout, even client_header_timeout and client_body_timeout directives, but if they bothered to take a peek into Nginx's error_log, they would've seen an error such as:


Exim ACL for blocking certain senders

This is definitely not spamIf you're in a need for fast and simple solution to block certain senders directly on Exim mail server, you're in luck. Couple of weeks back I needed to blacklist a spammer on a relay mail server, so that I could take my time and carefully trace the origin server/script from where the spam was being sent.

Implementing sender blocklist is very simple. Just open Exim's configuration file - if you're using CentOS or RHEL, look no further than /etc/exim/exim.conf. On Debian based distributions Exim's configuration is split into multiple files, so the recommended way of reconfiguring Exim is with dpkg-reconfigure exim4-config.


AWStats - poor man's download counter

Condescending WonkaA few days ago I was asked to configure AWStats to count downloads of .exe files on an website. I know that it's blindingly obvious that AWStats isn't the right tool for this job, but sometimes you have to pick battles with your clients. To save both my time and sanity I did what I was asked to do.

Interestingly, adding file download tracking functionality to AWStats proved to be very easy. In my case, the website was hosted on a cPanel server where AWStats was already installed, so I won't cover the whole installation procedure.


Change passwords for multiple cPanel accounts (bulk password reset)

Geeks and repetitive tasksThe other day I needed to change passwords for multiple cPanel accounts. Since there was a lot accounts in question, changing passwords manually was out of the question. Changing passwords from shell using passwd utility was also out of the question because that would change only the password for Unix user - MySQL and FTP passwords would remain unchanged. In the end I wrote a simple script which automates changing system, FTP and MySQL passwords for cPanel user.