How could I shutdown a remote host, in my network thru ssh, with a local host? – Ask Ubuntu

The question is simple.
What would be the script I would have to use to shut down a computer in my network thru ssh.

Normaly i would go to command line and:

ssh desktop

delik@desktop's password: 

delik@desktop:~$ sudo shutdown -P 0

To power on I created a file and wrote:

wakeonlan xx:xx:xx:xx:xx:xx

And gave it the executable bit

That way to power on it requires only a double click. Would i be capable of doing the same to shutdown?

Source: How could I shutdown a remote host, in my network thru ssh, with a local host? – Ask Ubuntu

How could I shutdown a remote host, in my network thru ssh, with a local host? – Ask Ubuntu was last modified: July 13th, 2017 by Jovan Stosic