I for the life of me still can't wrap my mind around bitmasks. I am sure they are very simple, I just haven't found something that makes how they work click in my brain yet.

What would be the bitmask value that I need to put into /proc/sys/kernel/sysrq to only allow these SysRq commands? represents enabled command, X represents disabled commands:

✓  r - 4=0x4   - Puts the keyboard into raw mode
✓  k - 4=0x4   - Kills all programs on the current virtual console
✓  s - 16=0x10  - Flushes data from your cache to disk
X  u - 32=0x20  - Remounts all file systems read-only
X  e - 64=0x40  - Sends the terminate signal to all processes
X  i - 64=0x40  - Sends the kill signal to all processes
X  b - 128=0x80 - Reboots your computer

You just add the values that you want to be active. However, bitmask values are supposed to be unique. So I guess the value of r & k switch should be different. According to this answer, 4 deals with keyboard controls, instead of kill all program. Assuming that all you need is r & s switch, you want the 4+16=20 value

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.