Author Archive

Disable PDFs in Safari

Some consider Safari a very poor PDF reader (myself included).

An easy way to disable Safari as a PDF  reader is the following command executed in a terminal window:

defaults write WebKitOmitPDFSupport -bool YES
Comments Off on Disable PDFs in Safari more...

Mounting an encrypted drive

he drive I am using here is a USB drive that has been mounted and encrypted on my laptop running RHEL6 (Red Hat Enterprise Linux 6). I want to mount on a server also running RHEL6.

I run dmesg and I can see that the server recognises it as /dev/sdb:

USB Mass Storage support registered.
usb-storage: device scan complete
scsi 2:0:0:0: Direct-Access     Maxtor 6 Y120M0                PQ: 0 ANSI: 2 CCS
scsi 2:0:0:1: Direct-Access     WDC WD50 00AAKS-00YGA0         PQ: 0 ANSI: 2 CCS
scsi 2:0:0:0: Attached scsi generic sg1 type 0
scsi 2:0:0:1: Attached scsi generic sg2 type 0
sd 2:0:0:0: [sda] 240121728 512-byte logical blocks: (122 GB/114 GiB)
sd 2:0:0:1: [sdb] 976773168 512-byte logical blocks: (500 GB/465 GiB)



The operating system needs a device to talk to the under-lying encryption, to create this device on the new server we can use the cryptsetup utility. I am going to call the disk device d500.


cryptsetup luksOpen /dev/sdb1 d500


We can now look for the new device:

ls /dev/mapper/
control  d500  vg_lump-lv_root  vg_lump-lv_swap


Before we mount the disk we need a directory to mount it to.

mkdir /mnt/d500


Then mount the disk:

mount /dev/mapper/d500 /mnt/d500


We can also see the disk is now mounted:

df -h
/dev/mapper/d500      459G  198M  435G   1% /mnt/d500


If we want the disk to automatically mount upon boot we need to create an entry in /etc/fstab

If you need this to survive a reboot then an entry needs to be entered in /etc/crypttab so that the dev/mapper device is created at every reboot.

The fields are:

Name (that will be created under /dev/mapper/[name])   Device (often identified by UUID) and options (such as password to decrypt)

You can get the UUID by running the command


This will give you by default the UUIDs of all devices on the system.

You can then edit


then add something like:

d500    UUID=2e23233fc-2323-49ba-a239-2872642-fd733219 none

Then when the system boots it will ask for the relevant password.

Adding a disk for SElinux & virt

A short one this.

Add the directories, set the contexts and then restore the contexts.

Still working on disk /mnt/d500


Create the directories I want to use:

mkdir -p /mnt/d500/libvirt/images


Set the context for the libvirt directory:

semanage fcontext -a -t virt_var_lib_t "/mnt/d500/libvirt"


Set the context for the images directory:

semanage fcontext -a -t virt_image_t "/mnt/d500/libvirt(/.*)?"


Then write the contexts:

restorecon -R /mnt/d500/

Then check the contexts:

ls -lZd /mnt/d500/libvirt/images/



I bought a GT-740FL GPS logger to use when running races that disallow GPS devices with displays. This device has no read out, is motion activated and so can be left on for a couple of days.

It only comes with Windows drivers (not tested) and a dreadful manual. Many of the links on the manufacturer’s website are broken. (You may be wondering why I bought it – I read a couple of good reviews online.)

Getting the logs off are quite easy with the right software.

I am using myTracks and Trailrunner

myTracks I use to copy off the GPS logs and I use Trailrunner to log my runs etc.

We see below the main page for myTracks

myTracks main screen









myTracks preferences tab



We now go to preferences.








myTracks preferences main



The first page lands us on General, from here switch to GPS Devices





myTracks preferences default




Once here click on Start GPS Logger Assistant



Screen Shot 2013-11-11 at 18.09.32



The GPS Logger Assistant lists all available devices, I filtered it on my device



Screen Shot 2013-11-11 at 18.09.40



Here we see the device is listed as a Canmore GT-740FL




Screen Shot 2013-11-11 at 18.10.17

Click through and follow the instructions






Screen Shot 2013-11-11 at 18.47.09


The device once detected will return with the following defaults, with one exception, the baud rate at the bottom is set to 0. I changed this to the correct baud rate of 4800, this will allow the device to be used as a live GPS device and provide live tracking on myTracks (under the view menu)


I have got live tracking working on Fedora but have not found software that will download the tracks from the device.



Alfresco upgrade on RHEL

This upgrade doc was written with the help of the following document

This is an upgrade from Alfresco 4.2.c to version 4.2.e but may well work for other versions.

I assume Alfresco 4.2.c is installed under the default directory /opt/alfresco-4.2.c

Stop Alfresco:

#service alfresco stop

Ensure that the old version does not start automatically upon reboot:

# chkconfig alfresco off

We need to find out what the database password is to dump the database:

# grep db.password /opt/alfresco-4.2.c/tomcat/shared/classes/

This will show the current db password. e.g. here it is dbpass4.2.c


Install the newer version of Alfresco:

chmod a+x alfresco-community-4.2.e-installer-linux-x64.bin


run through all the installation prompts and when finished I let it start up, one thing I did to allow it to be installed alongside the old version to to call the start-up script alfresco-e

Once installed and started we can stop the new Alfresco:

# service alfresco-e stop

we now need to just start the database:

# su – postgres

$ /opt/alfresco-4.2.c/postgresql/bin/pg_ctl start -w -D /opt/alfresco-4.2.c/alf_data/postgresql

We now need to dump the current database:

$ cd /opt/alfresco-4.2.c/postgresql/bin

./pg_dump -Fc alfresco > backup.pgb

We now stop the old database:

$ /opt/alfresco-4.2.c/postgresql/bin/pg_ctl stop -w -D /opt/alfresco-4.2.c/alf_data/postgresql/

We now have a database dump that can be used to populate a new database in the new installation. First we have to create the database, then populate it.

we now start the new database:

cd /opt/alfresco-4.2.e/postgresql/bin/

$ /opt/alfresco-4.2.e/postgresql/bin/pg_ctl start -w -D /opt/alfresco-4.2.e/alf_data/postgresql/

After that we connect to the new postgres instance to create the new database:

$ ./psql -U postgres -h localhost

Now enter the new password (which is the admin password you used during installation of alfresco-4.2.e), if you have forgotten you will find it in /opt/alfresco-4.2.e/tomcat/shared/classes/

Now create the database, where we will restore the data to:

postgres=# create DATABASE alfresco_42c;


The \q will quit out of the database shell

We left the database dump in the existing alfresco installation directory, so we address it from there when restoring

$ ./pg_restore -d alfresco_42c /opt/alfresco-4.2.c/postgresql/bin/backup.pgb

Now we will stop the database

$ /opt/alfresco-4.2.e/postgresql/bin/pg_ctl stop -w -D /opt/alfresco-4.2.e/alf_data/postgresql/

We now need to point the new installation to our new database:

use your favourite editor to change the database referenced by the new Alfresco:

switch back to root

$ exit

# vim /opt/alfresco-4.2.e/tomcat/shared/classes/

change to

We first delete the default installation data and then replace it with our repository data:

# cd /opt/alfresco-4.2.e/alf_data

# rm -rf contentstore  contentstore.deleted  keystore  oouser   solr  solrBackup

(this is everything in the directory apart from postgresql)

now we sync everything across:

rsync -trv –progress –exclude=”/postgresql/” /opt/alfresco-4.2.c/alf_data/* /opt/alfresco-4.2.e/alf_data

It should now be possible to restart the new repository:

# service alfresco-e restart

And test the web interface; depending upon how fast your machine is and how much data it will take some time to restart

Finally we have to copy across any global settings we may have such as mail and share settings in /opt/alfresco-4.2.c/tomcat/shared/classes/ to /opt/alfresco-4.2.e/tomcat/shared/classes/

Last is a restart to take the new settings:

# service alfresco-e restart

The Alfresco community page has some horrible broken javascript that never shows me the download links in Firefox:

Here they are here:

Get started by downloading the latest version of the Alfresco Community Edition.

Get started by downloading the latest version of the Alfresco Community Edition.

Windows 32
Deploy Alfresco on Windows (32-bit).
Windows 64
Deploy Alfresco on Windows (64-bit).
Deploy Alfresco on Linux (64-bit).
Mac OS
Deploy Alfresco on Mac OS (64-bit).

Authenticating against Zimbra LDAP


Put the correct user, hostname and domain in. This is using as a domain. The capital w ensures it asks you for your password.

ldapsearch -x -h $hostname -D uid=$user,ou=people,dc=$example,dc=co,dc=uk -W

This search uses a standard user to authenticate.

You can authenticate using the main LDAP user and password; however I suggest creating a separate user with few permissions, just to make the bind.

You can find out the main LDAP password by running

zmlocalconfig -s | grep ‘ldap_’ | egrep ‘password|url’  as zimbra user on your mail server

If you really want to use the root LDAP user to bind the DN is uid=zimbra,cn=admins,cn=zimbra as seen below

The configuration below allows all zimbra users to connect to the owncloud instance using their zimbra details. Please also note that the default for Zimbra is to use unencrypted connections. This means that the bind is going across the network unencrypted. Hence not a great idea to use the root LDAP user. One can search for how to set up Zimbra to use ldaps.

Main LDAP config for owncloud

Main LDAP config for owncloud

Advanced LDAP config for owncloud

Advanced LDAP config for owncloud

Helpful UNIX commands

Strip spaces from file names

find -name ‘* *’ -type f | sort | while read FILE; do NEWFILE=`dirname “${FILE}”`/`basename “${FILE}” | sed ‘s/ /_/g;’`; mv “${FILE}” “${NEWFILE}”;done


Delete files with a specific string in their name:

find . -name “*conflict*” -exec mv {} rm -f \;

This will find files with conflict in their name and delete them. You may want to run it without the rm -f first to check to see what it will delete.

Copyright © 1996-2013 Xander Harkness. All rights reserved.
iDream theme by Templates Next | Powered by WordPress