Archive for the ‘Reference’ Category

Quick Drupal install on Ubuntu 10.04 server

Here’s some instructions for doing a really quick Drupal install on Ubuntu server 10.04.

This assumes that you are well versed with Drupal and have already created your database and database user and given the rights to the DB user to access the DB.

Step 1 download, extract, and copy the files into the /var/www root

$ cd /
$ sudo wget
$ sudo tar xvzf drupal-6.20.tar.gz
$ sudo mv drupal-6.20/* drupal-6.20/.htaccess /var/www
$ sudo rm -rf drupal-6.20.tar.gz
$ sudo rm -rf drupal-6.20

Create the files directory and give it the proper ownership

$ sudo mkdir /var/www/sites/default/files
$ sudo chown www-data:www-data /var/www/sites/default/files

Copy default settings.php file to settings.php so that you can enter your own server and database details

$ sudo cp /var/www/sites/default/default.settings.php /var/www/sites/default/settings.php
$ sudo chown www-data:www-data /var/www/sites/default/settings.php

From here you would need to edit /var/www/sites/default/settings.php and enter in our server, database, and database user details.

I would also like to note that you can also install Drupal with aptitude on Ubuntu, but I would much prefer to install Drupal manually and use Drush to update drupal whenever I want to have it updated.

I only want Drupal updated when I say so and with what versions that I decide on.

$ sudo apt-get install drupal6

Installing Drush (at the time of this writing 4.2 is the latest version)

$ sudo apt-get install php5-cli
$ cd /usr/local/
$ sudo wget
$ sudo tar zxvf drush-All-versions-4.2.tar.gz
$ sudo rm -rf drush-All-versions-4.2.tar.gz (remove downloaded and extracted tar file)
$ cd drush (to make sure the files are there)
$ sudo chmod 555 drush

Create symbolik link
$ cd /usr/local/bin
$ sudo ln -s /usr/local/drush/drush drush

How to configure remote shared access to a git repository on Ubuntu using SSH keys

Requirements: I have a need to share a git repository on a publicly facing server with our development team who are geographically disparate. The team should not have full root SSH access to the server, and the repository should be private (not publicly accessible).

We would like to use SSH keys for authentication so that the developer does not have to type in their password each time they issue a git command that interacts with the server.

These instructions assume Ubuntu Linux 10.04 and Mac OS X client. The instructions are pretty identical if your local workstation is some flavour of Linux. If you want instructions on how to generate a SSH key on Windows, follow these instructions from, which are listed at the bottom of this post.

Begin on the server in question that we’ll call

#create a group for a repository
create group in webmin (gittestuser)

#create a user for the repository and add it to the group.
#Make sure and create a home directory for that user.
create user in webmin (gittestuser)

#give the group rights to the repository – in our example: gittest

chgrp -R gittestuser /srv/repos/git/gittest
chmod -R g+swX /srv/repos/git/gittest

then issue these commands

su gittestuser              # switch to the git user
cd ~                            # change to gittestuser's home directory
mkdir .ssh                   # make the .ssh dir
touch .ssh/authorized_keys      # create an empty authorized_keys file

On Mac OS X client
#generate your local SSH Public key

cd ~/.ssh
ssh-keygen -t rsa -C ""

# stores it in /.ssh/

cd ~/.ssh

#copy the public key to the .ssh/authorized_keys file for the gittestuser user using
#handy utility called ssh-copy-id
NOTE: You will need to download a copy of the ssh-copy-id script which is not part of Mac OS X for some reason.
#install and set permissions for ssh-copy-id on your local Mac OS X machine

$ sudo curl "" -o /usr/bin/ssh-copy-id
$ sudo chmod +x /usr/bin/ssh-copy-id

#once you’ve downloaded the ssh-copy-id script, you want to use it to copy your rsa id to the ~/.ssh/authorized_keys file on the server using the following command.

$ /usr/bin/ssh-copy-id

#SSH into the server with root and verify that the authorized_keys file has been updated

$ ssh
$ less /home/gittestuser/.ssh/authorized_keys

#test ssh access using the gittestuser account and that it is using the SSH key, not requiring a password

$ ssh

#Once, normal SSH access is enabled change the shell for gittestuser to /usr/lib/git-core/git-shell
#so that the only type of access the user has to the server is git.
#First, find out where the git-shell is located:

$ which git-shell
$ which results in "/usr/lib/git-core/git-shell"

#edit passwd file for gittestuser (make sure you are logged in as root if not, use sudo)

$ sudo nano /etc/passwd

#change gittestuser shell from /bin/sh to /usr/lib/git-core/git-shell the following line should look like:


I’ve also found that you can change the shell to /usr/lib/git-core/git-shell by editing the user through the webmin interface, which is obviously alot easier.

#Now you can try accessing the server with the shell changed and you should be disconnected.
#The following lines are what you should see when trying to connect via regular shell.

fatal: What do you think I am? A shell?
Connection to closed.

The reason that you change the shell, is so that your developers can only issue git type commands on the server through SSH access, they don’t get any real SSH access to the server.

#now try to clone the repository from the local Mac OS X machine.

git clone

Instructions for Windows that may be helpful to you:
For Windows, the best way to do generate an SSH key is to install Win/msysgit, the instructions for Win/msysgit can be found at

The instructions for generating the key are very similar to Linux, but can be found here.

Prevent your SSH connection from locking up

Have you ever been working on a Terminal shell SSH session, get busy and then went back to the shell to issue some more commands or look at something only to find that the shell window has locked up.

This requires you to close the Terminal window, open a new one and then login to your remote session again.

In a previous post here, I showed you how to create a ~/.ssh/config file.

Simply add these two lines to your ~/.ssh/config file and any SSH connection that you have to a remove server should not lock up.

ServerAliveCountMax 3
ServerAliveInterval 10

Two brilliant color scheme oriented websites

If you are doing any development work at all, the theming and UI process is extraordinarily important.

I’ve found two websites, which I’ve been using for various projects.

The first, and probably widely known is This has color combination schemes, many of which are contributed by the community (your fellow designers/developers).

The second, is called and it allows you to submit an individual color, and it will show you color matches and complimentary colors. It has extensive options and tools for the discerning designer.

How to recursively set the file permissions for all .php files on a *nix box

I had a need today to change the security of all .php files in a sub-directory, which contained dozens of sub-directories.

I figured out how to do it recursively with the find command. In the example below, I set all *.php files to chmod 755.
All other files with a file extension other than .php and directories were unaffected.

$ cd /mydirectory
$ find . -type f -name '*.php' -exec chmod 755 {} \;

I'm currently available
for Lotus Notes / Domino consulting engagements.


Connect with me: