AshvinandGitHub 9fdadd1c8f Point OpenSSH key setup at the file sshd actually reads (#4936)
* Point OpenSSH key setup at the file sshd actually reads

The Remote Access feature created %USERPROFILE%\.ssh\authorized_keys and
told the user to put their public keys there. sshd does not read that
file for a member of the administrators group; the "Match Group
administrators" block in sshd_config sends those logons to
C:\ProgramData\ssh\administrators_authorized_keys instead. WinUtil always
relaunches itself elevated, so the account it was setting up is always an
administrator, and key auth for it never worked.

The function tried to work around that by commenting the block out, but
those regexes anchor on $, and .NET puts $ before the \n of a CRLF pair.
The sshd_config Windows ships is CRLF throughout, so the replace was a
silent no-op on a stock install. On an sshd_config with LF endings it did
apply, and that is worse than not working: sshd gives an administrator
logon a full token with no UAC prompt, which is why Windows keeps those
keys in ProgramData behind an ACL that requires elevation to write.
Moving the lookup into the profile lets anything running as the user at
medium integrity append a key and get an elevated shell unprompted.

Use administrators_authorized_keys and give it the ACL sshd requires
(inheritance off, Administrators and SYSTEM only, by SID so localized
installs work). Where the sshd_config edit did land, undo it and copy any
keys out of the profile file first so key auth is not cut off mid-session.
Keys are only copied when the block needs restoring, so a default config
never grants access sshd was not already granting.

Also stop creating the profile .ssh directory: under elevation it was the
elevating administrator's profile, not necessarily the caller's.

* Document where to put SSH keys for the OpenSSH server feature
2026-08-09 13:08:33 -05:00
2024-08-30 09:48:21 -05:00
2025-05-23 11:26:48 -05:00

Chris Titus Tech's Windows Utility

Version Downloads Discord

A curated compilation of Windows system tasks streamline installs, debloat with tweaks, troubleshoot with config, and configure Windows updates. Run it fresh on every new Windows install.

Title Screen


Quick Start

WinUtil must be run as Administrator Because it performs system-wide changes.

Open PowerShell or Terminal as admin, then run:

Stable Branch (recommended)

irm https://christitus.com/win | iex

Development Branch

irm https://christitus.com/windev | iex

How to open an admin terminal

  • Start menu: Right-click Start → Windows PowerShell (Admin) or Terminal (Admin)
  • Search: Press the Windows key, and type PowerShell or Terminal, then Ctrl + Shift + Enter

Automation / Presets

Apply a predefined configuration without manual selection:

& ([ScriptBlock]::Create((irm https://christitus.com/win))) -Preset Standard
Preset Description
Standard Balanced defaults for most users
Minimal Minimal changes to suit every user
Advanced Deep tweaks for power users

To view exactly what each preset does, see: https://github.com/ChrisTitusTech/winutil/blob/main/config/preset.json


Build & Develop

See https://github.com/ChrisTitusTech/winutil/blob/main/.github/CONTRIBUTING.md


Resources


Support

Sponsors

These are the sponsors that help keep this project alive with monthly contributions.

User avatar: Yusuke SaitoUser avatar: User avatar: MartinUser avatar: Jason A. DiegmuellerUser avatar: RMSUser avatar: PaulUser avatar: Dave J  (WhamGeek)User avatar: Anthony MendezUser avatar: User avatar: DursleyGuyUser avatar: User avatar: Kiera MeredithUser avatar: Andrew PUser avatar: Sean (ANGRYxScotsman)User avatar: Abs

Contributors

Contributors

Thanks to everyone who has contributed time and effort to this project. Keep rocking 🍻

S
Description
Mirror of winutil
Readme MIT
38 MiB
Languages
PowerShell 100%