A collection of thoughts, tips, musings and the occasional recipe. Basically all the stuff I am supposed to remember.

Changing the date display format in Ubuntu 10.04 LTS

I am basing the majority of this off of the info I found at: http://ccollins.wordpress.com/2009/01/06/how-to-change-date-formats-on-u...

Basically I wanted to change how GTK based apps display the date. I wanted the format to be YYYY-MM-DD. In KDE this can be changed via the control panel-like interface. Gnome does not seem to have this option.

Gnome simply uses the same data that you can find by running the locale command. What we will end up doing is cloning our current locale, editing it, then installing our custom locale.

The locales are located at /usr/share/i18n/locales. In my case my locale is en-CA so I am going to use that as a base for my custom locale, thus preserving currency and language settings.

  1. sudo cp /usr/share/i18n/locales/en-CA /usr/share/i18n/locales/custom

I then edit that file looking for a line that starts with , the complete line looks like this:

  1. d_fmt  "<U0025><U0064><U002F><U0025><U006D><U002F><U0025><U0079>"

While this may look unintelligible it is really just a Unicode representation of the "date" command's command line interface.

Updating the BIOS for my Latitude E6400 from Linux

The BIOS on my beloved Latitude E6400 has never been updated. The problem was that I did not have a valid Windows license for this computer.

I initially tried to solve this by moving one of the hard drives from another one of our Latitude E6400s, but for some reason Windows refused to boot on my E6400 (there were slight differences in hardware, different wifi adapter and a faster Intel CPU in my laptop).

Plan B was to try updating the BIOS by using a FreeDOS cd with the BIOS utilities on it, but FREEDOS did not seem to like (as in did not have a valid driver) the DVD drive in the E6400s.

Plan C was to do the updating from within Linux itself. The following procedure I pieced together from a number of different sites.

The first thing I did was to confirm what version I currently had installed:

  1. $ sudo dmidecode -s bios-version
  2. A14

The next step was to set up the repository in order to download the firmware tools:

  1. wget -q -O - "http://linux.dell.com/repo/firmware/bootstrap.cgi" | bash

Note, that the previous command requires administrative or root access, and sudo does not cut it. You need to log in to a root shell.

  1. sudo su -
will do nicely.

Now we install the binaries: aptitude install firmware-addon-dell Now I needed to know what the device ID was:

How to change the Windows 7 Logon Background Image

I have recently moved my last remaining Windows workstation to Windows 7.  The login screen now has a background image that I am not particularly fond of.  It turns out that this relatively trivial to change.

First, click on the Windows buttons (where the old start bar used to be), in the "Search programs and files" box, type regedit.  You should see regedit.exe displayed.  Right click this and select "Run as Administrator (you don't actually use Windows as an administrative user I hope).  Once you type in your admin credentials you see the old trusty registry editor interface.  Find the following registry key:

HKLM\Software\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background

Remove Active Directory cached credentials

To remove cached credentials (from Windows XP machines anyway).

Run regedit.  Then navigate to HKEY_LOCAL_MACHINE\SECURITY\CACHE\

From there delete NL$1 through NL$10 as these are the hashes of the cached credentials.

Removing DisableRegistryTools policy

The problem:

You try to run regedit and you get the following response:

Error "Registry Editing has been disabled by your administrator"

The answer is to use the REG.EXE CLI utility:

 

REG add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableRegistryTools /t REG_DWORD /d 0 /f

In theory this solution is only for stand alone Windows XP machine, though I have personally seen this be effective on an XP machine managed by Active Directory (we did have local admin privledges).

You can also use the old "at" command from the Windows command line to launch a shell with SYSTEM privs.

at 21:01 /interactive “cmd.exe”

There is nothing here that cannot be found on the internet, specifically http://windowsxp.mvps.org/tweakuirest.htm and http://www.askstudent.com/hacking/demonstration-of-windows-xp-privilege-escalation-exploit/

Data recovery blog

I came across a couple of pretty good sites detailing some of the tools and processes I use for data recovery.

http://wiki.lunarsoft.net/wiki/Data_Recovery

http://shsc.info/DataRecovery

Basically this wiki steps you through recovering data via a bootable Linux CD/USB. This wiki recommends RIPLinux, though I personally use SystemRescueCd which is just another bootable Linux distribution designed for data and system recovery.

The utilities which are important are ddrescue, badblocks, and smartctl.  I also use foremost, autopsy, ntfs-3g, ssh/scp, rsync, samba, 7z when doing data recovery work. 

Essentially the first task is to see just what kind of shape the drive is in.  For this we use smartctl to query the drive's S.M.A.R.T. statistics.  These numbers will tell us just how many errors the drive is producing, and can give us an estimate of how much time we have to work with. 

a "smartctl --all /dev/<device>" will print the stats from that particular drive. 

For example, on one of my systems I run the following:

Syndicate content