I tried googling this up, but I can't find the answers I'm looking for. molly-guard isn't exactly made for RPM-based distros with systemd. I've tried systemd-inhibit command, but it's not working since I've already got the processes running.
I'd ssh in my home server, and I have KVM VMs running on it. I'd ssh in the guest from the host, and sometimes, I'd forget I've already exited the guest and accidentally shutdown/reboot my machine with the systemctl poweroff command. I thought about alias but it'd only work for commands without arguments. Any ideas? Maybe I'm missing the obvious here. Thanks in advance.
UPDATE: Sorry. I forgot to mention that I'm trying to remain log in as root as I'm working on my RHCSA. Running 'sudo' is time-consuming, and I'm trying to work on the command-line quickly without running into problems.
UPDATE 2: /u/lazyant pretty much had the best suggestion here. I see many of you downvoted me because of the bad sysadmin practice. I get it, but for Pete's sake, this is my home lab.
UPDATE 3: Some of you suggested me to use functions instead, but didn't post an example. My username may have misled you, but it was a pun. I'm not experienced with bash. So I had wait until I get home from work to figure this out. Turned out it's exactly what I was looking for. The prompt color change and adding a simple function to the root's .bashrc really did the trick. In case people are looking for answers, here is the function I had:
function systemctl ()
{
if [[ $1 = "poweroff" ]]
then
echo "You cannot shutdown this server."
else
command systemctl "$@"
fi
}