User Tools

Site Tools


linux

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

Clean unused deps in Arch Linux

yaourt -Rsn $(yaourt -Qdtq)

Install local pkg.tar in Arch Linux

pacman -U .pkg.tar.gz or .pkg.tar.xz

Howto create and mount encrypted disk

Create:

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

Mount:

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

Unmount:

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
linux.txt · Last modified: 2019/03/08 22:33 by hanez