From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28710 invoked by alias); 9 May 2002 11:12:36 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 28684 invoked from network); 9 May 2002 11:12:33 -0000 Received: from unknown (HELO alageremail1.agere.com) (192.19.192.106) by sources.redhat.com with SMTP; 9 May 2002 11:12:33 -0000 Received: from alcerelay.agere.com (alcerelay.agere.com [128.94.213.32]) by alageremail1.agere.com (8.10.2+Sun/8.10.2) with ESMTP id g49B9nf19095; Thu, 9 May 2002 07:09:49 -0400 (EDT) Received: from almail.agere.com by alcerelay.agere.com (8.9.3+Sun/EMS-1.5 sol2) id HAA00755 for ; Thu, 9 May 2002 07:12:31 -0400 (EDT) Received: from PAI820G1006951 by almail.agere.com (8.9.3+Sun/EMS-1.5 sol2) id HAA21182; Thu, 9 May 2002 07:12:30 -0400 (EDT) From: "Gerald S. Williams" To: "Jason Tishler" , Subject: RE: Finding your SID (was Re: problem starting inetd as NT service) Date: Thu, 09 May 2002 04:29:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 In-Reply-To: <20020508201144.GA1252@tishler.net> X-SW-Source: 2002-05/txt/msg00534.txt.bz2 Jason Tishler wrote: > You can find your SID (the "proper info" from above), by scanning through > the following registry key: > > HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList > > Choose the one where ProfileImagePath contains your $USERNAME. After expanding variables, I was able to look for where ProfileImagePath is equal to $USERPROFILE. YMMV. I was able to come up with a short script that does the equivalent of "mkpasswd -d -u $USERNAME" on my system. However, I did not know what to do about the group number. Based on my system and other e-mail I've seen, I just hardcoded 513 for now, but that's probably not universally correct. Is there any way to get that info from the registry? -Jerry P.S. Here's the script I used. It's in Python, and only works using the WINDOWS version right now since Cygwin Python doesn't support the _winreg module. ----- #!/usr/bin/echo THIS_IS_ONLY_FOR_WINDOWS_PYTHON from _winreg import * from os import environ class User: def __init__(self,masterkey,sid): self.sid = sid userkey = OpenKey(masterkey,sid) self.data = {} for valueno in range(QueryInfoKey(userkey)[1]): (name,data,type) = EnumValue(userkey,valueno) self.data[name] = data userkey.Close() profilePath = self.data['ProfileImagePath'].split("%") for i in range(1,len(profilePath),2): profilePath[i] = environ[profilePath[i]] self.profilePath = "".join(profilePath) users = [] masterkey = OpenKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList") for userno in range(QueryInfoKey(masterkey)[0]): users.append(User(masterkey,EnumKey(masterkey,userno))) masterkey.Close() profilePath = environ["USERPROFILE"] userName = environ["USERNAME"] userDomain = environ["USERDOMAIN"] for user in users: if user.profilePath == profilePath: # Not clear what to use for group ID. Is 513 universally OK? # This assumes you want your home directory in /home/userName print ":".join([userName, \ "unused_by_nt/2000/xp", \ user.sid.split("-")[-1], "513", \ "U-" + userDomain + "\\" + userName + "," + user.sid, \ "/home/" + userName, \ "/bin/bash"]) -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/