You are not logged in.

#1 2017-10-11 15:13:25

deisi
Member
Registered: 2015-10-21
Posts: 66

systemd remote suspend or shutdown

Hey Guys.
Is it possible to remotely shutdown or suspend a server(pc name is serv) via systemd?

I found with -H one can execute systemd tasks remotely. I tried to suspend the remote system with:

systemctl -H alarm@serv suspend -i

but the response is:

Failed to set wall message, ignoring: Interactive authentication required.
Failed to suspend system via logind: Interactive authentication required.
Failed to start suspend.target: Interactive authentication required.
See system logs and 'systemctl status suspend.target' for details.

I added the user alarm on the remote machine and added a ssh key. I made sure it can login with:

ssh alarm@serv 

On the server the user alarm is in the power group. I also added the following line to sudoers file:

alarm ALL=NOPASSWD:/usr/bin/systemctl suspend

I also tried to skipp the wall warning by adding --no-wall to the remote command but with no effect. It seems that systemd only allows to execute suspend if the user is logged in locally but I cant find any way around it.

Offline

#2 2017-10-12 19:27:58

teckk
Member
Registered: 2013-02-21
Posts: 590

Re: systemd remote suspend or shutdown

Is it possible to remotely shutdown or suspend a server(pc name is serv) via systemd?

ssh into it and issue sudo systemctl suspend

Offline

Board footer

Powered by FluxBB