delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2023/09/22/20:16:18

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 563923858025
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1695428177;
bh=A/I0oXHg5jBzn6qi0c49DuV41WV1a4kDQhJCl6pftYM=;
h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=YT/mo3zSIMqayrVtSiC5SKw3b+Q4+WYs/wVNykduTKKm0DhpEo4SZWG2kZtP/4pi3
pm6XjX40vS9Wz8u49um20Oh48eyLSdNIcqwXCy73HTOlV1z1oQ3uCQF54PbuaJly/h
/NCoWKGUTZkTn0GLn2E+1/bDs5bwAYJFzJYFKiaQ=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 147343858D28
Message-ID: <905e7aef-3cbf-4a4e-a8d9-037e10691d8d@huarp.harvard.edu>
Date: Fri, 22 Sep 2023 20:15:30 -0400
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: Shell API to get Windows SID from Cygwin name?
To: cygwin AT cygwin DOT com
References: <CANH4o6Myw2==vuhFQ=5ux3vj991u3-qEofQpbTOr3CYUJBf-Gw AT mail DOT gmail DOT com>
<8ccc20eb-b921-d6d1-bc61-03aa24314ebd AT Shaw DOT ca>
In-Reply-To: <8ccc20eb-b921-d6d1-bc61-03aa24314ebd@Shaw.ca>
X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS,
SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: "Allen, Norton T. via Cygwin" <cygwin AT cygwin DOT com>
Reply-To: "Allen, Norton T." <allen AT huarp DOT harvard DOT edu>
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 38N0GIMY020535

On 9/22/2023 8:07 AM, Brian Inglis via Cygwin wrote:
> On 2023-09-21 23:58, Martin Wege via Cygwin wrote:
>> Does Cygwin have a shell (e.g. bash) API to lookup the Windows SID for
>> a given Cygwin user or group name?
>> /usr/bin/getent usersid thisisausername
>
> Forget Windows! Think Unix:
>
> $ getent passwd $USER    # sanitized output:
> $USER:*:$UID:545:U-$HOSTNAME/$USER,S-1-5-21-...-...-...-1001:$HOME:/bin/bash 
>
>
According to the man page, getent passwd takes a numeric UID, not a user 
name. But if you don't provide a UID, it basically lists what would be 
in /etc/passwd, which you could parse to locate the row you want by 
username.



-- 
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019