rset(1) : Formulas

Windows

Windows may be used as a target by enabling the OpenSSH server and by installing a Linux-like environment.

Enable SSH

The SSH daemon is installed using Optional Features. SSH clients have elevated permissions, so there is no need for the equivalent of sudo.

winget install Microsoft.Edit
edit %PROGRAMDATA%/ssh/administrators_authorized_keys

Install Unix Tools

winget install Cygwin.Cygwin

Change the default shell

Set-ItemProperty -Path "HKLM:\HKEY_LOCAL_MACHINE\SOFTWARE\OpenSSH" -Name "DefaultShell" -Value "C:\cygwin64\bin\sh.exe"

Ensure Unix tools are found first in the search path

[Environment]::SetEnvironmentVariable(
  "Path",
  "C:\cygwin64\bin;" + [Environment]::GetEnvironmentVariable("Path", [EnvironmentVariableTarget]::Machine),
  [EnvironmentVariableTarget]::Machine)

Windows Scripting

PowerShell scripts are normally blocked by the Windows Execution Policy, but they are unrestricted when reading commands interactively, or on Standard In

interpreter=powershell -NonInteractive -NoLogo -Command -

test:
   date