From 1dc5b0b858371cf09232b92d5c2e705aaa46571d Mon Sep 17 00:00:00 2001 From: zeus Date: Thu, 27 Apr 2023 10:44:02 +0200 Subject: [PATCH] add: sudowarning --- bash/sudowarning.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 bash/sudowarning.sh diff --git a/bash/sudowarning.sh b/bash/sudowarning.sh new file mode 100644 index 0000000..bfc19b1 --- /dev/null +++ b/bash/sudowarning.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# sudowarning this perferably goes to /etc/bash.bashrc +# This shows a custom warning before executeing sudo. Ideal to prevent sudo-usage on host, where this is unwanted (like jumphosts) +sudo () { + local command=$@ + read -rp "You are about to run the command $(echo -e "\e[1;34;33m$command\e[0m") on the Jumphost. As root. Are you really sure? (y/N):" + if [[ "$REPLY" = [yY]* ]]; then + command sudo "$@" + else + return $? + fi +} +