How to lock access to system control on Fedora 19+

Recently I wanted to make a “black-box” style laptop limiting access to a non-privileged Linux user to only insert characters with the keyboard, this is: no ctrl+alt+del, only one tty, no graphical environment, no action for power, suspend, and other laptop buttons, no mouse, … so, only the keyboard input.

It is a very very easy thing.

black-box-us

Here is how I did it on a Fedora 19 laptop:

1. Start with runlevel 3:

ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target

2. Disable ctrl-alt-del

ln -s /dev/null /etc/systemd/system/ctrl-alt-del.target

3. Disable VTerms and laptop buttons

Edit /etc/systemd/logind.conf like this:

[Login]
NAutoVTs=0
 
#Ignore inputs
HandlePowerKey=ignore
HandleSuspendKey=ignore
HandleHibernateKey=ignore
HandleLidSwitch=ignore
PowerKeyIgnoreInhibited=yes
SuspendKeyIgnoreInhibited=yes
HibernateKeyIgnoreInhibited=yes
LidSwitchIgnoreInhibited=yes
#end Ignore inputs

4. Prevent blanking screen after timeout, and powersave.
Add a line to user .bashrc or global profile.d:
setterm -powersave off -blank 0

 How to restore the initial state:

1. Start with runlevel 5:

ln -s /lib/systemd/system/graphical.target /etc/systemd/system/default.target

2. Enable ctrl-alt-del.

ln -s /etc/systemd/system/reboot.target /etc/systemd/system/ctrl-alt-del.target

3. Comment all the lines of logindd.conf except the NAutoVTs. Set it for example to 4.

4. Re-enable powersaving.