Molly-guard doesn't work

Hello,

from my Manjaro I administrate my Rasperry Pis. Unfortunately it already happened that I accidentally restarted my local system instead of the remote system.
Under Debian/Ubuntu or Raspbian molly-guard works very well.

https://aur.archlinux.org/packages/molly-guard

Unfortunately, molly-guard doesn’t seem to work locally on my Manjaro, even though I changed the config:

cat /etc/molly-guard/rc
# molly-guard settings
#
# ALWAYS_QUERY_HOSTNAME
# when set, causes the 30-query-hostname script to always ask for the
# hostname, even if no SSH session was detected.
ALWAYS_QUERY_HOSTNAME=true

# USE_FQDN
# when set, causes the 30-query-hostname script to ask for the fully-qualified
# hostname, rather than the short name
#USE_FQDN=true

sudo reboot

is performed after the sudo password prompt without asking for the hostname.

What am I doing wrong?

Do I perhaps have a way elsewhere to set up the reboot of my machine via the console with a security prompt?

vkr
psyc

I have already tested it with Manjaro XFCE and Manjaro KDE, with the same result.

Did you read and proceed this after installation?

https://aur.archlinux.org/cgit/aur.git/tree/molly-guard.install?h=molly-guard

1 Like

Hello,

thank you very much. No, I have not seen this hint yet.
How do I have to apply this?

user$ source "/etc/profile.d/molly-guard.sh"
user$ sudo reboot

reboot without asking for the hostname

user$ sudo source "/etc/profile.d/molly-guard.sh"
sudo: source: command not found

Maybe you can help me with this?

thanks and greetings
psyc

Gosh… this guard works with aliases. These aliases written in /etc/profile.d/molly-guard.sh and gets loaded after every login.

source "/etc/profile.d/molly-guard.sh" is only needed if you need it instantly without re-log/reboot.

Simply don’t use sudo here? As I see it replaces: halt poweroff reboot shutdown, but not sudo. It is not needed here. Or add like mentioned an alias: alias sudo="sudo "

Hello Megavolt,

unfortunately, I don’t quite understand it. Why is it not clearly described in the documentation what must be done?
I did a little “try and error” At the end I have the following lines in my

~/.bashrc

# molly-guard
source "/etc/profile.d/molly-guard.sh"
alias sudo='sudo '

If i type

sudo reboot

it asks for the hostname and (the most important) if I cancel this security question, my local manjaro will not reboot either.

Nice!!

Thanks for your patience.
Greetings
psyc

Because molly-guard is just a simple helper script, just like for example manjaro-chroot. It is just a helper to setup such a simple guard. You can do it also without it pretty easy, just write some functions and add aliase, thats it.

The only source I found is the one from debian, so I conclude it is made with debian in mind, just like manjaro-chroot is made with manjaro in mind.

It is pretty much this script: File: shutdown.in | Debian Sources 126 lines of code. I don’t understand why you need to use exactly this, but well, everyone has different habits.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.