DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 63NMulY41491819 Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 63NMulY41491819 Authentication-Results: delorie.com; dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=NUsnSNch X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BA5EA4B99F6B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1776985005; bh=nrxqk5ON4tF5lcLZmM1ioRLd8iyFjQBu9qa4LWftc4w=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=NUsnSNchPQnHeb0rs4UyscWOAyAAAi/bdgbSWkov2GDQzEItqIbaGLRySxMUz2GYr va0wu31JcXxWJ8Qi82dgnGotMf8MOXq1NbL9DRwF4cjmDrjVQGM6ut30vtsiCNt+Wd nJI0rOEdz3EdqTutPyfTdcMYWuBDi7fAfL0L9MnE= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 865F24BAE7EF ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 865F24BAE7EF ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776984956; cv=none; b=XFhjKQaoMwLebCPaodT30q5vD8JpcD2rvnyiazxMw5oqq4gE6cCViMNGyQ3eBYeBPQSlLJtunb1rnfvzfu3AkgMbR6v80+I1Od+w2vSakIRBPhUNON9ovYxah94LObhoTssf50aJnO5vMmPlYZREimenuVQ6Cs4N/rR80XS1rbA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776984956; c=relaxed/simple; bh=HiuX6/5vyMFTV+hM5kUxmpzpOFV2V+uQmQRBYus/JC4=; h=Message-ID:Date:MIME-Version:From:Subject:To:DKIM-Signature; b=l4TubDOTdQrMnI0zRt71libocZgPrIGbLFv+1tB8h0x+DCOpr0savXVCqaAD1PMisBRWKtnDvgITROGnTMiyKDmUnVS2oyx5AcR9cASGFAFltZICuavpgG1zRYsvDKCde8eWOQLxs5LasOmDJ+PkoTj1+7R4ZibRuq1Vp4m6rVg= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 865F24BAE7EF Message-ID: Date: Thu, 23 Apr 2026 16:55:53 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Getting Windows "MACHINE SID" without fork() & exec()? Content-Language: en-CA To: General Cygwin discussions and problem reports References: Organization: Systematic Software In-Reply-To: X-Stat-Signature: ntc14u8cppep3txrjrmtpysocberczgj X-Rspamd-Server: rspamout04 X-Rspamd-Queue-Id: 7F01320025 X-Session-Marker: 427269616E2E496E676C69734053797374656D6174696353572E61622E6361 X-Session-ID: U2FsdGVkX1//nDYpPfcEMSbWPLtTpocv3Via7IYEnl0= X-HE-Tag: 1776984954-676171 X-HE-Meta: U2FsdGVkX19nG8ByP8Gz7xV2jGI4MRrXe4AChoXy7MB1L0I0e/kO8eiwtBqjAzu7YmZxqA6meQPpfffNDfwIlLY13SUA2evBjiYiDIl4rIw3mAMa+boZRUPcEdXcE5ATBpYqObhUWTiP4z6WNzJyTy62HvT9cJjwmllDnhIxlFegDdIQ4FiIp/KBQXvjXKUDjO5h4nJQI4JyLedXbaegqXVcZJ9U8NJnvGRcBsd9d9ID+CBp0vUDIzo4mLH1XvWxwLULD8Fk04fG0kccZHU1CIj6CGGTsQkb86pjBzkY6gKIsV3qHAGJku3AxuvFA5w+rukGNMfxOV5hW/JKDdrEgvEsi9GeQxNqGK56iYceZ5NWvXMoyQ3Xq8ynHg/3niew2kWfiyYaOQ1xll99m4Fgb7EhBn9yKHaRlwJK2gSXtBo+7x7FBVcmeG5tbHZHE/KE9Pm9D0+IBVM= X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Brian Inglis via Cygwin Reply-To: General Cygwin discussions and problem reports Cc: Brian Inglis Content-Type: text/plain; charset="utf-8"; Format="flowed" Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 63NMulY41491819 On 2026-04-23 13:27, René Berber via Cygwin wrote: > On 4/23/2026 11:07 AM, Takeshi Nishimura via Cygwin wrote: > >> Does Cygwin have a secret shell variable or /proc file which contains >> the current machine's MACHINE SID, without having to resort to calling >> an external program (no fork(), no exec(), please)? > > Create your own environment variable.  Store it once per bash session > with .bashrc for example, or permanently with all the other Windows variables. > > Use PsGetSid to get the value into that variable (i.e. no super user access > needed like with regtool.) No regtool or superuser access needed for most queries and regtool accepts paths: $ l /proc/registry*/ /proc/registry/: HKEY_CLASSES_ROOT/ HKEY_CURRENT_CONFIG/ HKEY_CURRENT_USER/ HKEY_LOCAL_MACHINE/ HKEY_PERFORMANCE_DATA/ HKEY_USERS/ /proc/registry32/: HKEY_CLASSES_ROOT/ HKEY_CURRENT_CONFIG/ HKEY_CURRENT_USER/ HKEY_LOCAL_MACHINE/ HKEY_PERFORMANCE_DATA/ HKEY_USERS/ /proc/registry64/: HKEY_CLASSES_ROOT/ HKEY_CURRENT_CONFIG/ HKEY_CURRENT_USER/ HKEY_LOCAL_MACHINE/ HKEY_PERFORMANCE_DATA/ HKEY_USERS/ > Ref: https://learn.microsoft.com/en-us/sysinternals/downloads/psgetsid > > Caveat: The first time you run PsGetSid it shows a popup with the license > agreement. > > Example: > XPS-8930: ~ > $ /home/reneb/bin/SysinternalsSuite/PsGetsid > > PsGetSid v1.44 - Translates SIDs to names and vice versa > Copyright (C) 1999-2008 Mark Russinovich > Sysinternals - www.sysinternals.com > > SID for \\XPS-8930: > S-1-5-21-3651791898-1415975337-2452924111 > > XPS-8930: ~ > $ /home/reneb/bin/SysinternalsSuite/PsGetsid |& tail -n 3 > S-1-5-21-3651791898-1415975337-2452924111 Do you mean like these values replaced by '*'? $ regtool list -v /proc/registry/HKEY_USERS/ .DEFAULT\ () S-1-5-18\ () S-1-5-19\ () S-1-5-20\ () S-1-5-21-**********-**********-**********-1001\ () S-1-5-21-**********-**********-**********-1001_Classes\ () ... Of course, if the info is not yours, you probably will need elevated access! -- Take care. Thanks, Brian Inglis Calgary, Alberta, Canada La perfection est atteinte Perfection is achieved non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add mais lorsqu'il n'y a plus rien à retrancher but when there is no more to cut -- Antoine de Saint-Exupéry -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple