Ich kann meinen Spielerechner anschalten.
Also, ohne hin zu gehen:
$ cat bin/wake-steam#! /bin/sh
wakeonlan 70:8b:cd:4f:4d:5e
und dann geht er an, loggt sich ein, startet Steam und ich kann mich von einem richtigen Computer an das Steam verbinden.
Ich will den Spielerechner abschalten.
Ich könnte warten. Nach 30 Minuten Idle geht er aus.
Aber das sind 30 Minuten 80 Watt für nix.
Man kann einem Windows auf der Kommandozeile sagen, daß es rituellen Selbstmord begehen soll.
C:\Users\Admin> shutdown /s /f /t 0"Ich kann also OpenSSH auf dem Windows installieren, mich remote auf der Kiste anmelden und das Kommando ausführen.
Oder gleich ganz remote:
$ ssh Admin@rtx.local "shutdown /s /f /t 0"Password:
Das Paßwort stört.
Macht ja nix, ich kann ja meinen Key installieren.
Für Standard-User:
The contents of your public key (\.ssh\id_ecdsa.pub) needs to be placed on the server into a text file called authorized_keys in C:\Users\username\.ssh\.
Aber: Das funktioniert nicht, wenn der User Mitglied in der Administrators Group ist.
The contents of your public key (\.ssh\id_ecdsa.pub) needs to be placed on the server into a text file called administrators_authorized_keys in C:\ProgramData\ssh\.
Beachte, dass das nicht per User ist, sondern Shared für alle User, die in Administrators sind.
Nun gut, ist ja eine Personal Workstation, gibt also nur einen User und der ist immer Administrator, also muß das immer nach da und nie nach %HOME%\.ssh.
# Get the public key file generated previously on your client$authorizedKey = Get-Content -Path $env:USERPROFILE\.ssh\id_ecdsa.pub
# Generate the PowerShell to be run remote that will copy the public key file generated previously on your client to the authorized_keys file on your server
$remotePowershell = "powershell Add-Content -Force -Path $env:ProgramData\ssh\administrators_authorized_keys -Value '''$authorizedKey''';icacls.exe ""$env:ProgramData\ssh\administrators_authorized_keys"" /inheritance:r /grant ""Administrators:F"" /grant ""SYSTEM:F"""
# Connect to your server and run the PowerShell using the $remotePowerShell variable
ssh username@domain1@contoso.com $remotePowershell
Und dann, damit alles, alles, alles zerbricht:
For non-English localized versions of the operating system, the script will need to be modified to reflect group names accordingly.
Mein Windows ist English, also geht es, aber die armen Würste, die Windows scripten mussen.
Aber nein:
To prevent errors when granting permissions to group names, the Security Identifier (SID) can be used in its place. The SID can be retrieved by running Get-LocalGroup | Select-Object Name, SID. When using the SID in place of the group name, it must be preceded by an asterisk (*).
In the following example, the Administrators group uses the SID S-1-5-32-544:
$remotePowershell = "powershell Add-Content -Force -Path $env:ProgramData\ssh\administrators_authorized_keys -Value '''$authorizedKey''';icacls.exe ""$env:ProgramData\ssh\administrators_authorized_keys"" /inheritance:r /grant ""*S-1-5-32-544:F"" /grant ""SYSTEM:F"""Und bei Microsoft wundern sich hochbezahlte Marketingmenschen wieso Linux die Welt erobert hat.