An open API service indexing awesome lists of open source software.

https://github.com/urbanware-org/inhibit

Script to prevent accidental execution of critical commands, e.g. to shutdown or reboot the system
https://github.com/urbanware-org/inhibit

accidental aliases bash halt poweroff prevent reboot shutdown

Last synced: 5 months ago
JSON representation

Script to prevent accidental execution of critical commands, e.g. to shutdown or reboot the system

Awesome Lists containing this project

README

          

README (Inhibit)

Project

Inhibit
Version 1.5.0
Copyright (c) 2026 by Ralf Kilian

GitHub: https://github.com/urbanware-org/inhibit
GitLab: https://gitlab.com/urbanware-org/inhibit

Definition

The Inhibit project is a tool to prevent accidental execution of
critical commands, e.g. to shutdown or reboot the system by prompting
the user to enter its hostname.

License

This project is distributed under the MIT License. You should have
received a copy of the license along with this program (see 'LICENSE'
file). If not, you can find the license terms here:

https://opensource.org/licenses/MIT

Usage

Now, to e.g. prevent the accidental execution of the 'shutdown',
'poweroff', 'halt' and 'reboot' commands, add the following lines
either to '/etc/bashrc' (system wide) or '~/.bashrc' (for the current
user, only).

In the following examples 'inhibit.sh' is located in '/opt/inhibit'.

# Prevent certain commands to shutdown the system in any way
alias halt='/opt/inhibit/inhibit.sh halt'
alias poweroff='/opt/inhibit/inhibit.sh poweroff'
alias reboot='/opt/inhibit/inhibit.sh reboot'
alias shutdown='/opt/inhibit/inhibit.sh shutdown'

You can also give command-line arguments for the inhibited command,
for example:

alias poweroff='/opt/inhibit/inhibit.sh poweroff -f'

It is also possible to also inhibit commands for services controlled
by 'systemctl'.

alias systemctl='/opt/inhibit/inhibit.sh systemctl'

Notice that this alias will have no effect unless you explicitly add
the name of the service (or services) which should be confirmed to the
service list inside 'inhibit.conf'. Details can be found inside that
file.

After adding the preferred aliases, you can apply the changes either
by logging out and in again or by reloading the '.bashrc' file of the
current user (depending on in which file you have added the aliases).

$ source ~/.bashrc

Now, if you want to execute one of those commands for which you have
set up (created aliases for) Inhibit, you will explicitly have to
confirm their execution.

Contact

Any suggestions, questions, bugs to report or feedback to give? If so,
you can find the contact information inside the 'CONTACT' file.

Legal information

The project name is completely fictitious. Any correspondences with
existing websites, applications, companies and/or other projects are
purely coincidental.

All trademarks belong to their respective owners.

Errors and omissions excepted.