I am running Buster after fairly deafult installation. One of my scripts executes '/usr/bin/systemctl poweroff' command. And I am having trouble executing this script from cron.
1. If run from user's CLI, the script succeeds. 2. If run from root crontab the script succeeds. 3. If run from user's crontab it fails with the following errors: "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." 1. Why, when the script is run by the user cron job, the execution requires authentication, while run from the same user terminal, it does not. 2. Is there a way to get rid of this behaviour, since I prefer the script being executed by the user's cron job? 3. I am also surprised that 'systemctl poweroff' command can be executed either directly from the user's terminal or by running a script without any authentication request. There's certain inconsistency here, isn't it? IMHO, it does not feel like a safe approach. Thanks.