Last active
July 29, 2026 23:47
-
-
Save PierreAndreis/bc5e7a2efeee2bdf06809be86d444082 to your computer and use it in GitHub Desktop.
Temporary Multifactor Windows SSH setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 | |
| Start-Service sshd | |
| Set-Service sshd -StartupType Automatic | |
| $key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL+8D83rLmSNINKLwGqRHyfKlJEpGM+YA+Ox8zq9o6zm" | |
| New-Item C:\ProgramData\ssh -ItemType Directory -Force | Out-Null | |
| Set-Content C:\ProgramData\ssh\administrators_authorized_keys $key -Encoding ascii | |
| icacls C:\ProgramData\ssh\administrators_authorized_keys /inheritance:r | |
| icacls C:\ProgramData\ssh\administrators_authorized_keys /grant "*S-1-5-18:F" "*S-1-5-32-544:F" | |
| Remove-NetFirewallRule -Name Codex-OpenSSH -ErrorAction SilentlyContinue | |
| New-NetFirewallRule -Name Codex-OpenSSH -DisplayName "OpenSSH from Codex Mac" -Direction Inbound -Protocol TCP -LocalPort 22 -Action Allow -RemoteAddress 192.168.86.37 -Profile Any | |
| Restart-Service sshd | |
| whoami | |
| Get-NetTCPConnection -LocalPort 22 -State Listen |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment