Monday, January 9, 2012

Encrypted /home with cryptsetup easy and fast


1: partition;

modprobe dm-crypt aes-x86_64

cryptsetup -c aes-xts-plain -y -s 512 luksFormat /dev/sda4

# Also remember that in order for other accounts to still be able to unlock this partition, you need to add all Linux account passwords as keys to unlock the partition.

cryptsetup luksAddKey /dev/sda4

cryptsetup luksOpen /dev/sda4 home

ls /dev/mapper/home

mkfs.ext4 -O dir_index /dev/mapper/home

<volume fstype="crypt" path="/dev/sda4" mountpoint="/home" />

2: file

losetup -f /path/file

cryptsetup -c aes-xts-plain -y -s 512 luksFormat /dev/loop0

# Also remember that in order for other accounts to still be able to unlock this partition, you need to add all Linux account passwords as keys to unlock the partition.

cryptsetup luksAddKey /dev/loop0

cryptsetup luksOpen /dev/loop0 home

ls /dev/mapper/home

mkfs.ext4 -O dir_index /dev/mapper/home

<volume fstype="crypt" path="/dev/sda4" mountpoint="/home" options="loop"/>

Oracle (Sun) Java 6 in Ubuntu 10.04 LTS


First Part:
  1. Download *rpm.bin package from official site. Try to install it and it fails with unpacked rpm package.
  2. Convert with alien: alien --scripts ./jre-6u30-linux-amd64.rpm
  3. dpkg -i jre_1.6.030-1_amd64.deb
  4. update-alternatives --get-selections |grep java
  5. update-alternatives --install "/usr/bin/java" "java" "/usr/java/default/bin/java" 1
  6. update-alternatives --set java /usr/java/default/bin/java
  7. update-alternatives --list java to check
  8. update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/java/default/bin/java" 1
  9. update-alternatives --set javaws /usr/java/default/bin/javaws
 Second part - browser plugin:
Google chrome found plugin without problems. The steps for Firefox are following:
  1. Check what's in /usr/lib/mozilla/plugins/ and remove open jdk icedtea or whatever. Name "libjavaplugin.so" is important. 
  2. Simply link it this way:

ln -s /usr/java/default/lib/amd64/libnpjp2.so /usr/lib/mozilla/plugins/libjavaplugin.so

Or use update-alternatives:

update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin" "/usr/java/default/lib/amd64/libnpjp2.so" 1
update-alternatives --set mozilla-javaplugin "/usr/java/default/lib/amd64/libnpjp2.so"

 Third part. Don't forget about Look&Feel:

(Default Ubuntu location)
/etc/java-6-sun/swing.properties
# uncomment to set the default look and feel to GTK
swing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel

(New with authintic Java install):

/usr/java/default/lib/swing.properties 
# uncomment to set the default look and feel to GTK
swing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel

set JAVA_HOME=/usr/java/default; in /etc/environment or export in .bashrc