Linux Stuff


Useful commands

Start GUI program as different user:

xhost +SI:localuser:testuser

su - testuser -c "export DISPLAY=:0.0 && firefox"

After exit you should disable acces by running:

xhost -SI:localuser:testuser

Everything in one command:

xhost +SI:localuser:testuser && su - testuser -c "export DISPLAY=:0.0 && firefox && exit" && xhost -SI:localuser:testuser

Howto create and mount encrypted disk


cryptsetup luksFormat /dev/sdb1
cryptsetup luksOpen /dev/sdb1 crypto
mkfs.ext2 /dev/mapper/crypto


cryptsetup luksOpen /dev/sdb1 crypto
mount /dev/mapper/crypto /mnt/crypto


umount /dev/mapper/crypto
cryptsetup luksClose /dev/mapper/crypto

Change Key:

In LUKS scheme, you have 8 “slots” for passwords or key files. First, check, which of them are used:

cryptsetup luksDump /dev/sdb1 | grep BLED

Then you can add, change or delete chosen keys:

cryptsetup luksAddKey /dev/sdb1 (/path/to/<additionalkeyfile>)

cryptsetup luksChangeKey /dev/sdb1 -S 6

As for deleting keys, you have 2 options:

a) delete any key that matches your entered password:

cryptsetup luksRemoveKey /dev/sdb1

b) delete a key in specified slot:

cryptsetup luksKillSlot /dev/sdb1 6