Archief voor februari 2006

hal & ivman

2 februari 2006 Reacties uit

Using the Hardware Abstration Layer (HAL) and the volume manager lvman, you can do nice things, like automatically mount drives or play cdroms and dvd’s. Also it can help you stop doing things you hate like automtically mount drives or play cdroms and dvd’s.

Both hal and lvman come standard with my Ubunto distro, but I’m sure you will be able to found information how to make these two run on your favourite distro.

In this article I’ll tell you how I use it.

# lshal
gives you all kinds of information that the hal is able to tell you about your computer. All of this information will help you configuring the things you want to do if something happens with your hardware.

know have a look at the lvman configuration file /etc/lvman/IvmConfigActions.xml. You will see some examples that are already configured by Ubuntu. If you want you can disable the autorun function for CD’s, look for lines like these (at least in Kubuntu, in Ubuntu it will be slightly different):

just add comment tags  around these lines or delete them if you don't want autorun.If I plug in my digital camera I want digikam to start. So I plugged in the camera, used lshal to look for the info I found for the camera and decided I want tu use the device_id as identifier for lvman:

Categorieën:Linux Tips & Trics Tags:

SSH / SCP Wrapper

2 februari 2006 Reacties uit

My company has a lot of servers on which I have to log in with ssh and copy files to with scp several times a day. I didn’t want to type in my password every time, so I decided to use the ssh built-in feature of authorized_keys. It is not very secure to use 1 key for all servers, so I wrote a small shell script that looks for the right key everytime I use ssh or scp. To be more secure, I put the keys on an encrypted filesystem on a usb stick.


# shellscript around scp/ssh that looks for keys according to the hostname argument of scp/ssh
# your keys should be named _id_dsa (or modify this script)
# in the next howto you shold replace <$VARNAMES> with the value you assign to it
# to create ssh keys type:
#   ssh-keygen -t dsa -f $CRYPT_PATH/_id_dsa
# add contents of $CRYPT_PATH/ to ~/.ssh/authorized_keys
# if this file does not exists, simply copy $CRYPT_PATH/ to ~/.ssh/authorized_keys

# save this file to $SCP_WRAPPER anywhere in your $PATH
# and add a symbolic link to the same file:
# finally add these line to your ~/.bashrc file:
#  alias ssh="/PATH/TO/$SCP_WRAPPER"
#  alias scp="/PATH/TO/$SSH_WRAPPER"

################ CONFIGURATION ################
# path to your keys:

#script / programs names:
SCP="/usr/bin/scp -C"

# set to 1 if you have different domainnames for a single server
# that way you can have 1 keyfile for the server
################             END            ################


. /lib/lsb/init-functions

# function to get realhost from ssh/scp argument
getServerByHost ()
local host
if [ "$USE_NS_LOOKUP" == "0" ]; then
echo "skipping hostname lookup"
return 0
log_begin_msg "trying to get servername from $1"
host=$(nslookup $1 | grep Name|cut -d: -f2|head -n1|sed 's/^s*//')
if [ "$host" == "" ]; then
log_end_msg 9
return 9
log_end_msg 0
echo "using host $host in stead of $1"
return 0

# function that checks if the kyfile exists
getKey ()
if [ "$(sudo cryptsetup status $CRYPT_MAPPER_PATH 2>/dev/null |grep active -c)" == "0" ]; then
log_begin_msg "/etc/init.d/cryptdisks not started: trying to start it now"
sudo /etc/init.d/cryptdisks start 2>/dev/null
if [ "$(sudo cryptsetup status /dev/mapper/crypt 2>/dev/null |grep active -c)"   == "0" ]; then
log_end_msg 9
return 9
log_end_msg 0

if [ "$(mount | grep "$CRYPT_PATH" -c)" == "0" ]; then
log_begin_msg "encrypted disk not mounted, mount now"
log_end_msg $?

if [ -f "$KEY" ]; then
echo "using key $KEY"
return 0
echo "key [$KEY] not found"
return 9

# function that checks for correct argument count
paramcheck ()
if [ $3 -lt $3 ]; then

if [ "$(basename $0)" == "$SCP_WRAPPER" ]; then
paramcheck scp 2 $#
hostArgument=$(echo $*|sed 's/^.* (.+):.*/1/')
paramcheck ssh 1 $#

#shortcut if keyfile exists:
if [ -f "$CRYPT_PATH/$1""_id_dsa" ]; then
echo "found key $KEY, skipping everything else"
getServerByHost $hostArgument

if [ "$KEYARGUMENT" == "" ]; then
if [ "$retval" -eq "0" ]; then
getKey $HOST
if [ "$?" -eq "0" ]; then KEYARGUMENT="-i $KEY"; fi
echo "fallback to normal operation of $(basename $EXECUTABLE)"
exit 9

exit $?
Categorieën:Linux Tips & Trics Tags:

Ricoh Co SD Card Reader

1 februari 2006 Reacties uit

I finally got my SD/MMC card reader working on my Dell Inspiron 6000, thanx to the Secure Digital Host Controller Interface driver. I have written a howto, which you can find in my Inspiron 6000 section. Because the driver is based on on the Secure Digital Host Controller Interface, this should work on every every card reader based on this protocol, not only on the Ricoh reader.

Ricoh SD reader in Dell Inspiron 6000

Ricoh SD reader

My first attempt was with the standard Lunux kernel source from Ubuntu. After applying the patches, it did not work. So I started with a fresh source tree. For the nest steps you need to be root or use sudo

  1. download kernel tree tar from and extract tar in /usr/src
  2. download the 3 patches from Sdhci-development mailing list, I’ve used the 10.0 Patches from the Sdhci-development list: Save the patches to /anywhere/you/like.
  3. patch your kernel:
    1. cd /usr/src/linux-
    2. patch -p1 < /anywhere/you/like/sdhci-0001.bin
    3. patch -p1 < /anywhere/you/like/pci-sdhc-0001.bin
    4. patch -p1 < /anywhere/you/like/mmc-respopcode-0001.bin
  4. config your kernel, If you have an Inspiron 600, you can try my .config
  5. build your kernel, for example:
    1. make-kpkg –rev custom1.0 kernel_image
    2. dkpg -i ../kernel-image-
  6. reboot and hope for the best!

Look in my other articles for more tips and trics for the hard/software configuration of the Dell Inspiron 6000.

Categorieën:Linux on Dell Insipron 6000 Tags:

Encrypted filesystem

1 februari 2006 Reacties uit

I want to log in on our servers with ssh without having to type in a password every time, so I decided to use authorized_keys. To store the keys I wanted an encrypted filesystem on my usb stick. Here’s a short howto:
install crypt system debian style:
# apt-get install cryptsetup

make sure the modules aes, dm_mod, and dm_crypt are loaded (add to /etc/modules) or compiled in your kernel. You need these modules for the device mapper and for aes encryption algoritm.

map the device that is going to hold the encrypted filesystem (here it is /dev/sdb1) to a mapped device (I called it crypt, pick a valid name you like for the device mapper):
# cryptsetup -y create crypt /dev/sdb1

add the device to /etc/crypttab, by simply adding the line:
crypt /dev/sdb1

optionally add device to /etc/fstab (example configuration):
/dev/mapper/crypt /media/crypt ext3 rw,user,exec,noauto,suid 0 0

make filesystem on the mapped device (I use ext3, use anything you like and is supported on your system):
mkfs.ext3 /dev/mapper/crypt

use the device:
# /etc/init.d/cryptdisks start

if you’ve added the fstab line you can use:
# mount /media/crypt
otherwise try:
# mount /dev/mapper/crypt /media/crypt

Categorieën:Linux Tips & Trics Tags: