GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Conversation

Notices

  1. Embed this notice
    Kris (isotopp@infosec.exchange)'s status on Wednesday, 22-Jan-2025 07:28:57 JST Kris Kris
    Einen Windows-Rechner abschalten

    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.

    Shutdown Command

    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.

    Microsoft so:

    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.

    In conversation about 4 months ago from infosec.exchange permalink

    Attachments


    • GreenSkyOverMe (Monika) repeated this.
    • Embed this notice
      Stefan Baur 6 * 💉 (farbenstau@infosec.exchange)'s status on Wednesday, 22-Jan-2025 07:29:05 JST Stefan Baur 6 * 💉 Stefan Baur 6 * 💉
      in reply to

      @isotopp Du kannst den Shutdown afaik auch via smb und rpc auslösen, dann sparst Du Dir das ssh-gefrickel auf Windowsseite. Da gab's ein Tool dafür … suchmaschinel mal nach "net rpc", "net rpc shutdown" und "rpcclient".

      In conversation about 4 months ago permalink
    • Embed this notice
      Frederic (frederic@chaos.social)'s status on Wednesday, 22-Jan-2025 07:29:11 JST Frederic Frederic
      in reply to

      @isotopp Hilft vielleicht https://github.com/brann0n/SleepOnLan ?

      In conversation about 4 months ago permalink

      Attachments

      1. Domain not in remote thumbnail source whitelist: opengraph.githubassets.com
        GitHub - brann0n/SleepOnLan: Small Project that can receive WOL (wake on lan) packages verify them and then perform an action of choice (sleep for now)
        Small Project that can receive WOL (wake on lan) packages verify them and then perform an action of choice (sleep for now) - brann0n/SleepOnLan
    • Embed this notice
      WooShell (wooshell@chaosfurs.social)'s status on Wednesday, 22-Jan-2025 07:29:16 JST WooShell WooShell
      in reply to

      @isotopp Ich bin ja schon ein wenig erstaunt, dass Microsoft nicht auch die Befehle in KraftSchale lokalisiert hat, so wie sie es mit den Funktionen in Excel etc gemacht haben...

      "kraftschale Hinzufüge-Inhalt -Zwang -Pfad $umgebung:Programmdaten\ssh\Systembetreuer_berechtigte_Schlüssel... "

      In conversation about 4 months ago permalink

Feeds

  • Activity Streams
  • RSS 2.0
  • Atom
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.