Archive

Archive for August, 2009

Windows: checking file integrity with sha1 and/or md5

August 31st, 2009

Some Internet available software, normally free software, provides a checksum for file integrity testing.

What is this for? By checking that the checksum of the downloaded file matches the checksum provided on the source web site you’ll have a guarantee that the file was not modified (hacked) – unless the web site checksum was too..

So on windows how do you verify this?

There’s a tool (fciv.exe) provided by Microsoft(r) that can compute sha1 and md5 checksums. You can download it at http://support.microsoft.com/kb/841290.

After downloading it, you can extract it to c:\windows\ to make the command widely available.

Next you can verify the checksum of a downloaded file, say for example the gnupg installation package for windows. On the web site the sha1 checksum was published. Let’s verify it:

C:\external\Software\gnupg>fciv gnupg-w32cli-1.4.9.exe -sha1
//
// File Checksum Integrity Verifier version 2.05.
//
c2efad983dfe50e6d8007257bad2c76604be389a gnupg-w32cli-1.4.9.exe

Great, it matches it so the file has it’s integrity intact.

To make things easier we can create the commands sha1sum and md5sum which are normally the standard command names to check sha1 and md5.

Let’s create 2 batch files, for sha1 let’s put the following contents and save it as c:\windows\sha1sum.bat:

@echo off
fciv %1 -sha1

and for md5 let’s put the following contents and save it as c:\windows\md5sum.bat:

@echo off
fciv %1

Now we can compute the checksums by calling these commands:

C:\external\Software\gnupg>sha1sum gnupg-w32cli-1.4.9.exe
//
// File Checksum Integrity Verifier version 2.05.
//
c2efad983dfe50e6d8007257bad2c76604be389a gnupg-w32cli-1.4.9.exe

C:\external\Software\gnupg>md5sum gnupg-w32cli-1.4.9.exe
//
// File Checksum Integrity Verifier version 2.05.
//
d90854104edcb72149472a99a9392d4e gnupg-w32cli-1.4.9.exe

Shell, Windows

Shutdown timer

August 30th, 2009

Here is a quick tip on how to set your pc to shutdown completely at a defined time.

Use the command shutdown (open an command prompt: Start > Run > cmd):

shutdown -s -f -t 3600

The command above shuts down your computer in 1 hour closing any running application.

Look at windows help for the complete synopsis of the command.

Windows

Bash: window size is too short, how do I change it?

August 26th, 2009

So I’m logged on to a Linux server using Bash shell over an ssh connection using Poderosa client.

When I time a long command for some reason the cursor at some point moves over to the beginning of the same line overwriting the command and everything becomes a mess. This is specially annoying while typing something you would like to cut and paste on an email for example.

So, what’s going on?

Bash has a variable that reports the number of columns setup:

$ echo $COLUMNS
80

Interesting, it is configured for 80 columns but my terminal window has 137 columns. Why is that?

There’s a Bash setting that will adapt the window size after each command:

checkwinsize
If set, Bash checks the window size after each command and, if necessary, updates the values of LINES and COLUMNS.

Let’s see what is it’s current value:

$ shopt -p | grep checkwinsize
shopt -u checkwinsize

That means it is disabled… Let’s enable it:

$ shopt -s checkwinsize

Now it is enable. Let’s check the COLUMNS value now:

$ echo $COLUMNS
137

Great!

Linux, Shell

Changing the configuration of Redhat Cluster Manager

August 20th, 2009

The Redhat cluster manager uses a cluster configuration system (man ccs) which can be managed by the ccs_tool tool.

To change the configuration file /etc/cluster/cluster.conf you have to follow the steps outlined below on the first node of your cluster:

  1. backup current cluster.conf
  2. copy /etc/cluster/cluster.conf to say /tmp/cluster.conf
  3. make the necessary changes to /tmp/cluster.conf
    1. Change also the config_version attribute of the cluster tag at line 2 increasing the value by 1.
  4. run ccs_tool with the update option:  ccs_tool update /tmp/cluster.conf
  5. if you’re using cman then run: cman_tool version -r <new config version>

If you don’t do item 5. and you’re using cman then your nodes will not be able to rejoin the cluster. To recover do the following:

  1. On the first node run cman_tool version -r <new config version>.
  2. On the other nodes restart the cman service.
  3. Restart ccsd
  4. Start rgmanager

Linux