Disable power button on keyboard

broken image
broken image
broken image

If the user logs off, the button will be enabled again. If you just need to disable it for one or many users, you can add this command to the Startup Applications, assuming the key code of your sleep button is 150: xmodmap -e 'keycode 150=' Once you have the key code, you mainly have two ways to automatically disable it.

broken image

To disable any key, you will need to get its code: xmodmap -pk | grep -i sleepįor me, the sleep button has the code 150 as you can see: 150 0x1008ff2f (XF86Sleep) 0x0000 (NoSymbol) 0x1008ff2f (XF86Sleep) 0x0000 (NoSymbol) 0x1008ff2f (XF86Sleep) 0x1008ff2f (XF86Sleep) Since Ubuntu 18.04, Bruno Pereira's answer doesn't seem to work anymore.