You are not logged in.
Hello! In continuation of https://bbs.archlinux.org/viewtopic.php?id=202016 : I have "poweroff" file in /usr/local/bin with contents:
#!/bin/bash
if grep -qs 'mapper' /etc/mtab
then
echo 'TrueCrypt volume is mounted!'
else
hwclock --utc -w
systemctl poweroff
fiThe problem is that "hwclock" program doesn't do its task because it needs root permissions to run. But the file itself has root owner and root group. And I also did "chmod +s" for that file. Still hwclock complains that I am not root and thus cannot perform this operation. AFAIK it should be done. As root. Where is my mistake?
Last edited by Mr. Alex (2015-09-12 15:09:24)
Offline
Offline
I think you might be able to accomplish this with sudo. Use visudo to add something like the following to /etc/sudoers:
username ALL=(ALL) NOPASSWD: hwclockThe call sudo hwclock from your script.
Last edited by Chazza (2015-09-12 13:22:30)
Offline
So there's no simple way of configuring the system to allow what I want to do?
Offline
Chazza, got your reply after my post #4. I'll try to do it now.
Offline
My line for sudoers is now
alex ALL=(ALL) NOPASSWD:hwclockand it doesn't work:
sudo: parse error in /etc/sudoers near line 1Can't figure out why. Everything looks correct.
Offline
Just figured it out. It wants the full path to hwclock.
Offline