Archive

For January, 2012

How to unmount an encrypted partition?

No Comments

Unmount the partition

umount /mnt

Unmap the partition

cryptsetup luksClose securebackup

How to mount an encrypted partition?

No Comments

Map the partition

cryptsetup luksOpen /dev/sdXN securebackup

Mount the partition

mount /dev/mapper/securebackup /mnt

How to setup partition encryption?

No Comments

To setup partition encryption on Ubuntu, perform the following steps:

Install the required software

apt-get install cryptsetup

For more security, erase the partition you want to encrypt with one of the following commands

sudo dd if=/dev/zero of=/dev/sdXN bs=4K
or
sudo badblocks -c 10240 -s -w -t random -v /dev/sdXN
or
sudo dd if=/dev/urandom of=/dev/sdXN bs=4K

Load the encryption kernel modules

sudo modprobe dm-crypt
sudo modprobe sha256
sudo modprobe aes

Enable encryption on the partition you want to encrypt

cryptsetup --verify-passphrase luksFormat /dev/sdXN -c aes -s 256 -h sha256

Map the partition you want to encrypt

cryptsetup luksOpen /dev/sdXN securebackup

Format the partition

mkfs -t ext3 -m 0 -O dir_index,filetype,sparse_super /dev/mapper/securebackup

 

How to backup and restore Windows 7 activation files

No Comments

It is possible to backup and restore the activation status of Windows 7

Backing up the activation files

To backup the activation status, backup the following files. Administrator access rights are required.  Make sure you have the Windows activation key.

  • %SystemDrive%\Windows\ServiceProfiles\NetWorkService\AppData \Roaming\Microsoft\SoftwarePlatform\Tokens.dat
  • %SystemDrive%\Windows\System32\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms (for 32 and 64 bits editions)
  • %SystemDrive%\Windows\SysWOW64\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms (only for 64 bits edition)

Restoring the activation files

To restore the activation status, restore the backup files.  Administrator access rights are required.  Make sure you have the Windows activation key.

  • Re-install Windows 7.  Nevertheless, do not supply the activation key when asked for.
  • Stop the Software Protection Service with the following command net stop sppsvc.  This command must be run as Administrator.
  • Replace the activation files with the one backed up.  Prior to do so, you must take ownership of the existing files.
  • Start the Software Protection Service with the following command net start sppsvc.  This command must be run as Administrator.
  • Register the product key for Windows 7 with the following command (as Administrator): slmgr.vbs -ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
  • Check the activation status with the following commands:
slmgr.vbs -dlv
slmgr.vbs -dli
slmgr.vbs -ato

How to use the loop device on Unix?

No Comments

The loop device on Unix lets access a file as a block device.  Disks are block devices.  So, it is possible to use a file as a disk.  The first step, create a file that will be used as a disk.

dd if=/dev/zero bs=1M count=100 of=/tmp/mydiskfile

Format your file as a file system.  If /dev/loop0 is already used, use /dev/loop1.

losetup /dev/loop0 /tmp/mydiskfile
mkfs.ext4 /dev/loop0
losetup -d /dev/loop0

losetup -d /dev/loop0 deletes the loop device

mount -o loop /tmp/mydiskfile /mnt

The file /tmp/mydiskfile  can now be used as a disk with /mnt as the mount point!

How to control the brightness of the display from command line?

No Comments

You can set the brightness of the display by issuing this command within a shell

echo 3 > /sys/class/backlight/acpi_video0/brightness

where 3 is the brightness level. Its value is from 0 up to the value in the file /sys/class/backlight/acpi_video0/max_brightness.

How to restore the normal scroll bars in Ubuntu 11?

No Comments

Simply create a file named /etc/X11/Xsession.d/80overlayscrollbars and put into it the following line:

export LIBOVERLAY_SCROLLBAR=0

or simply execute the following command

echo "export LIBOVERLAY_SCROLLBAR=0" > /etc/X11/Xsession.d/80overlayscrollbars

You need to do the above as root.  This fix also resolve the Eclipse scroll bars issues.

Blue Taste Theme created by Jabox