User Tools

Site Tools


linux

Differences

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

Link to this comparison view

linux [2019/03/08 22:32]
hanez created
linux [2019/03/08 22:33]
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>​ 
 + 
 +==== Clean unused deps in Arch Linux ==== 
 + 
 +<​code>​yaourt -Rsn $(yaourt -Qdtq)</​code>​ 
 + 
 +==== Install local pkg.tar in Arch Linux ==== 
 + 
 +<​code>​pacman -U .pkg.tar.gz or .pkg.tar.xz</​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: 2019/03/08 22:33 by hanez