Recovering a hacked Drupal system

In order to check if your Drupal 7 website has been hacked, install the following modules:

drush dl site_audit
drush dl drupalgeddon

clear drush cache and run:

drush cache-clear drush
drush asec

Some attack does two things: firstly, in creates NEW php files scattered throughout your directory structure. The files are all 494 bytes long, and end in "php" so they are easy to find. Run the following command to see if you have any:

find . -size 494c -name "*.php"

...and then run this command to delete them:

Resetting or updating passwords for Drupal users in command line


drush user-login username

command or it's alias

drush uli username

will display a one-time login URL to login the specified account. The output is a URL like:


After logging in using this URL, the user it NOT required to change the password.

To generate one time login for user #1 fire up just

drush uli


drush sqlq "SELECT name, pass FROM users WHERE uid = 1;"

Impending Drupal Site Launch? Use the List

After months of site development, code, more code, and long hours, launch day arrives. A site launch can come as a relief, create a bittersweet moment, or one filled with pride and a sense of accomplishment, not unlike a parent sending a child off to their first day of kindergarten.


Syncing Two Drupal Sites

The drush module for Drupal has a new “sync” option to synchronize two Drupal sites, but it is undocumented and looking at the source code all it does is sync the files, not the mysql database. I haven’t seen any other public solutions that do completely sync 2 drupal sites including the databases.


How to disable and enable Drupal 7 blocks programmatically

Sometimes you need to enable and place a Drupal 7 block in a seen region like header, content, footer, etc., and other times you need to disable it programmatically in a custom module. So to do it you just need to create two functions:

function _start_refreshing() {

'status' => 1,
'weight' => -10,
'region' => 'footer',
->condition('module', 'mymodule')
->condition('delta', 'mymodule_delta')



function _stop_refreshing() {


How to delegate a subdomain to another nameserver

In order to delegate a sub-domain's DNS management to another server, perform the following steps:

1. Set NS records for your subdomain and in DATA field put a nameserver: NS ns1.nameserver.tld NS ns2.nameserver.tld

2. Then create a new nameserver

3. Now you can start adding A records for your new subdomain, like:


If delivered mail doesn't show in user inbox

One of our Ubuntu servers stopped to show properly delivered messages in user inboxes after the last kernel update (Ubuntu precise (12.04.4 LTS)). Because for some reasons DEFAULT= and ORGMAIL= in /etc/procmailrc got replaced by


so we had to change it back to:


Now everything is working fine with the following settings for procmail:

[email protected]:/etc# cat procmailrc


Disable Named in chroot and remove chroot partition

The recent versions of bind recommends the chroot environment for better security. When considering the most used popular Linux distribution ‘Red Hat’, they ship a package called ‘bind-chroot’ for the chrooting of bind. By default the bind or named daemon runs in a chroot environment.

But users who want to run ‘named’ in the old fashion may do so by disabling the ‘chroot’ environment. The ‘chroot’ing feature can be disabled by commenting out the directive ‘ROOTDIR=/var/named/chroot’ in the file ‘/etc/sysconfig/named’ and then restarting the ‘named’ service.

df -h


How to install IonCube loader on CentOS 6.3

Download and uncompress the latest IonCube version:

wget # 32 bit
wget # 64 bit
tar xvfz ioncube_loaders_lin_x86-64.tar.gz

Then we go to the new IonCube source directory:
cd ioncube/

mv /usr/lib/php/modules/

Now edit /etc/php.ini and add the line zend_extension = /usr/lib/php/modules/


What is stopping Varnish?

Every so often with Pressflow and Varnish you might find that your anonymous users aren't being cached via Varnish.

A quick way to see whether your anonymous pages are being served is to add some debugging headers to Varnish by adding some code like the snippet here to vcl_deliver()

sub vcl_deliver {
if (obj.hits > 0) {
set resp.http.X-Varnish-Cache = "HIT";
else {
set resp.http.X-Varnish-Cache = "MISS";

and hit them with

curl -I


Subscribe to Front page feed