This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Solution to using different usernames

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


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.


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:


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.



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: FAQ: Documentation: Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]