delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/03/08/22:49:57

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=4.5 required=5.0 tests=AWL,BAYES_50,BOTNET,RCVD_IN_DNSWL_NONE
X-Spam-Check-By: sourceware.org
Message-id: <4D76F8BD.3070405@cygwin.com>
Date: Tue, 08 Mar 2011 22:49:17 -0500
From: "Larry Hall (Cygwin)" <reply-to-list-only-lh AT cygwin DOT com>
Reply-to: cygwin AT cygwin DOT com
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.21) Gecko/20090320 Remi/2.0.0.21-1.fc8.remi Lightning/0.9 Thunderbird/2.0.0.21 Mnenhy/0.7.5.0
MIME-version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Solution to using different usernames
References: <4D76DFDA DOT 5040107 AT gmail DOT com>
In-reply-to: <4D76DFDA.5040107@gmail.com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On 3/8/2011 9:03 PM, Jay Adams wrote:

<snip>

> I made the USER variable use the Windows variable USERNAME (standard
> variable). From there I could change the USERNAME variable simply by
> setting to what I like. I included the HOME variable in my code snippet.
> I don't know if editting /etc/passwd will have the same behaviour as
> editting /etc/profile and I don't know if /etc/passwd will change if I
> take my Cygwin install to another computer. The main need for this hack
> was that I use Cygwin from a USB and the default behaviour of Cygwin is
> to use the currently logged in user which would mean I would have tons
> of different profiles.

<snip>

> P.S. Still doesn't seem to work for SSH (ssh [user_to_use]@[machine]).
> Maybe problem with SSH?

No, I don't believe so.  The problem is that your '/etc/passwd' and
'/etc/group', which I assume you have on your USB drive, aren't updated
for each machine you're running on.  But since you're changing the user
name anyway, presumably back to something that is named in the '/etc/passwd'
file, the only real problem is that the mapping from uid to Windows SID
doesn't make sense on every machine.  You'll need to update the 5th field
for your favorite user in your '/etc/passwd' file.  You can get the values
you need to do this from the psgetsid utility found here:

<http://technet.microsoft.com/en-us/sysinternals/bb897417>

Replace the SID and the machine or domain name and user.  Do this for
the 5th field only.  The rest of the line should remain untouched.

Once that's done, ssh should be able to pick up the user that you're
logging in with by consulting the '/etc/passwd' file and that user should
then map to an existing SID on your USB drive Cygwin installation.

-- 
Larry

_____________________________________________________________________

A: Yes.
> Q: Are you sure?
>> A: Because it reverses the logical flow of conversation.
>>> Q: Why is top posting annoying in email?

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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