Uma solução para sua solicitação foi encontrada aqui
Na raiz .bash_profile, configure dois alias como:
alias shutdown='/usr/local/bin/confirm shutdown'
alias reboot='/usr/local/bin/confirm reboot'
Com /usr/local/bin/confirm
sendo algo como:
#!/bin/bash
echo "Before proceeding to perform $1, please ensure you have approval to perform this task"
echo -n "Would you like to proceed y/n? "
read reply
if [ "$reply" = y -o "$reply" = Y ]
then
/sbin/$1
else
echo "$1 cancelled"
fi
Notes:
- You can replace the
y
respond with your password- You can use shell-compiler to replace the shell script with a compiled code which won't expose the password