0

from pc1 as user1, the shutdown command doesn't cause any problems, but if I try to use it remotely on pc2 as user2 using the ssh protocol, it doesn't work: it requires authentication and then it works.

:~$ /usr/sbin/shutdown -r 0
Failed to schedule shutdown: Interactive authentication required.

~# /usr/sbin/shutdown -r 60
Reboot scheduled for Sat 2024-01-06 11:01:36 CET, use 'shutdown -c' to cancel.
 
~$ ls -l /usr/sbin/shutdown lrwxrwxrwx 1 root root 14 8 févr. 2023 /usr/sbin/shutdown -> /bin/systemctl 

further details:

  • from pc1 as user1 this command doesn't need "sudo".

How can I explain this behavior?

5
  • Do you use the same user for both operations ? I mean, from a pc as user and in ssh ? - shutdown command needs root / sudo privileges to be executed. If you are not using sudo and you are not root user, you should have specific privileges elevation like polkit or something.
    – hidigoudi
    Commented Jan 6 at 9:01
  • Probably something like in this question: Why is this error: "Interactive authentication required" popping up? I guess your shutdown is systemctl in disguise. Commented Jan 6 at 9:07
  • Why you add delay? Just exec sudo shutdown or sudo init 0 Commented Jan 6 at 9:15
  • Try sudo poweroff or systemctl poweroff, although a bit brutal.
    – harrymc
    Commented Jan 6 at 9:17
  • try ``ssh user2@pc2 "echo pa$sW0rd | sudo -S /usr/sbin/shutdown -r 0"''
    – Petepf
    Commented Jan 6 at 10:53

0

You must log in to answer this question.

Browse other questions tagged .