How to trigger a command on Linux when disconnected from power
9 months ago
- #Linux
- #Power Management
- #Security
- Introduction to a simple alternative to BusKill for triggering actions when a laptop's power is disconnected.
- Use case: Protecting an unlocked laptop from theft in public areas by powering off when disconnected from power.
- Setup involves creating a udev rule and a script to execute on power disconnection on Linux.
- For OpenBSD, the apmd daemon can be used as an alternative.
- Steps to create and configure the udev rule and executable script provided.
- Testing the setup involves unplugging the laptop to see if it powers off and checking logs for errors.
- Script ideas range from locking user sessions to destroying LUKS master keys for security.
- Conclusion highlights the usefulness of this method for laptops frequently used in public spaces while connected to power.