I've been having trouble with scheduled shutdown in Debian 10 and i've lost track of how it works.
As far as i understand /sbin/shutdown now points to systemctl. I can't execute ´shutdown´ even when using the su command though /sbin is set as part of roots PATH in /etc/profile
Code:
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi
Shouldn't this make it available for root at least?
However i made a script for scheduled shutdown using ´systemctl poweroff´ directly
The script does what it's intended to do without any further authentication when logged in locally. When logged in via ssh i get:
Code:
<user>@debian:~$ ./pc-shutdown.sh 0
<user>@debian:~$ Failed to set wall message, ignoring: Interactive authentication required.
Failed to power off system via logind: Interactive authentication required.
Failed to start poweroff.target: Interactive authentication required.
See system logs and 'systemctl status poweroff.target' for details.
´systemctl poweroff´ istelf works without password locally and needs two authentications when logged in via ssh, Once for a wall message then for systemctl poweroff.
I wonder why the script works without privileges when logged in locally in the first place.