User Tools

Site Tools


linux

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revision Both sides next revision
linux [2019/03/08 22:32]
hanez created
linux [2019/11/18 00:43]
hanez
Line 1: Line 1:
-Linux+====== Linux Stuff ====== 
 + 
 +===== Useful commands ===== 
 + 
 +==== Start GUI program as different user: ==== 
 + 
 +<code>xhost +SI:localuser:testuser 
 + 
 +su - testuser -c "export DISPLAY=:0.0 && firefox"</code> 
 + 
 +After exit you should disable acces by running: 
 + 
 +<code>xhost -SI:localuser:testuser</code> 
 + 
 +Everything in one command: 
 + 
 +<code>xhost +SI:localuser:testuser && su - testuser -c "export DISPLAY=:0.0 && firefox && exit" && xhost -SI:localuser:testuser</code> 
 + 
 +==== Howto create and mount encrypted disk ==== 
 + 
 +Create: 
 + 
 +<code>cryptsetup luksFormat /dev/sdb1 
 +cryptsetup luksOpen /dev/sdb1 crypto 
 +mkfs.ext2 /dev/mapper/crypto</code> 
 + 
 +Mount: 
 + 
 +<code>cryptsetup luksOpen /dev/sdb1 crypto 
 +mount /dev/mapper/crypto /mnt/crypto</code> 
 + 
 +Unmount: 
 + 
 +<code>umount /dev/mapper/crypto 
 +cryptsetup luksClose /dev/mapper/crypto</code> 
 + 
 +Change Key: 
 + 
 +In LUKS scheme, you have 8 "slots" for passwords or key files. First, check, which of them are used: 
 + 
 +<code>cryptsetup luksDump /dev/sdb1 | grep BLED</code> 
 + 
 +Then you can add, change or delete chosen keys: 
 + 
 +<code>cryptsetup luksAddKey /dev/sdb1 (/path/to/<additionalkeyfile>)</code> 
 + 
 +<code>cryptsetup luksChangeKey /dev/sdb1 -S 6</code> 
 + 
 +As for deleting keys, you have 2 options: 
 + 
 +a) delete any key that matches your entered password: 
 + 
 +<code>cryptsetup luksRemoveKey /dev/sdb1</code> 
 + 
 +b) delete a key in specified slot: 
 + 
 +<code>cryptsetup luksKillSlot /dev/sdb1 6</code>
linux.txt · Last modified: 2020/07/08 00:45 by hanez