Hiding Apache2 header info

Add these to your /etc/apache2/apache2.conf then restart Apache:

LoadModule headers_module /path_to/mod_headers.so
Header unset Server
ServerSignature Off
ServerTokens ProductOnly
Header unset X-Powered-By

Enabling FK support in SQLite with Firefox SQLite Manager

SQLite Manager is an awesome plugin for Firefox that lets you create & manage a SQLite db.

To enable FK support using SQLite Manager:

  • Go to DB Settings, change Foreign Keys to ‘On’, Press ‘Change’
  • Go to Tools, then ‘Use table for extension data’
  • Go to Tools, then ‘Open on-connect SQL’
  • Click on the ‘On connect SQL’ tab – the ‘On-connect SQL statements for THIS database’ textarea is now enabled.
  • In the field enter: PRAGMA foreign_keys=ON;
  • Press Save.

Syntax to create an FK ref:

<tt>CREATE TABLE child_table_name (field_1 INTEGER PRIMARY KEY,
field_2  TEXT,
foreign_key_field INTEGER ,
FOREIGN KEY(foreign_key_field)  REFERENCES parent_table_name(parent_key_field));</tt>

 

Enabling chrooted sftp access for WordPress automatic upgrades

Create wordpress user specifically for the auto update and add the user to the www-data group:

  • sudo adduser wordpress
  • sudo adduser wordpress www-data

chgroup the wordpress dir to the www-data group:

  • sudo chgrp -R www-data /var/www/wordpress

Add the following to /etc/ssh/ssd_config to chroot the wordpress user to the wordpress directory:

Match User wordpress
ChrootDirectory /var/www/wordpress
AllowTCPForwarding no
X11Forwarding no
ForceCommand /usr/lib/openssh/sftp-server

Restart the sshd service:

sudo /etc/init.d/ssh restart

Setup the sftp userid and password in the wordpress settings and select sftp.