public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* How to handle changed user ID
@ 2017-12-07 14:12 Thomas Wolff
  2017-12-07 15:03 ` cyg Simple
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Thomas Wolff @ 2017-12-07 14:12 UTC (permalink / raw)
  To: cygwin

I had to delete a corrupted Windows account and recreate it.
For cygwin, the new account, although with the same name, has a
different user id.
Of course, this creates access problems for existing files (even if they
appear to have the same user in ls -l, because the *old user* is still
listed in /etc/passwd).
Is there a canonical solution to this problem, other than running chown
-R $USER ~ ?
Can the new user be forced to use the previous user ID?
Thanks
Thomas

---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to handle changed user ID
  2017-12-07 14:12 How to handle changed user ID Thomas Wolff
@ 2017-12-07 15:03 ` cyg Simple
  2017-12-07 16:43   ` Corinna Vinschen
  2017-12-07 20:08 ` Brian Inglis
  2017-12-08  0:16 ` Achim Gratz
  2 siblings, 1 reply; 5+ messages in thread
From: cyg Simple @ 2017-12-07 15:03 UTC (permalink / raw)
  To: cygwin

On 12/7/2017 2:50 AM, Thomas Wolff wrote:
> I had to delete a corrupted Windows account and recreate it.
> For cygwin, the new account, although with the same name, has a
> different user id.
> Of course, this creates access problems for existing files (even if they
> appear to have the same user in ls -l, because the *old user* is still
> listed in /etc/passwd).
> Is there a canonical solution to this problem, other than running chown
> -R $USER ~ ?
> Can the new user be forced to use the previous user ID?

What happens if you simply remove /etc/passwd and /etc/group files?  A
change long ago caused these files to not be needed.

You may need to take ownership of the directories and their files at the
Windows system level.

-- 
cyg Simple

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to handle changed user ID
  2017-12-07 15:03 ` cyg Simple
@ 2017-12-07 16:43   ` Corinna Vinschen
  0 siblings, 0 replies; 5+ messages in thread
From: Corinna Vinschen @ 2017-12-07 16:43 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1297 bytes --]

On Dec  7 09:12, cyg Simple wrote:
> On 12/7/2017 2:50 AM, Thomas Wolff wrote:
> > I had to delete a corrupted Windows account and recreate it.
> > For cygwin, the new account, although with the same name, has a
> > different user id.
> > Of course, this creates access problems for existing files (even if they
> > appear to have the same user in ls -l, because the *old user* is still
> > listed in /etc/passwd).
> > Is there a canonical solution to this problem, other than running chown
> > -R $USER ~ ?
> > Can the new user be forced to use the previous user ID?
> 
> What happens if you simply remove /etc/passwd and /etc/group files?  A
> change long ago caused these files to not be needed.
> 
> You may need to take ownership of the directories and their files at the
> Windows system level.

Definitely, and this is independent of Cygwin.  The files have been
created with the Windows SID of the old user and thus the ownership
is still set to the old user.  Either taking ownership in Windows,
or starting a shell as admin and using chown -R (or more intelligent
variations using find) should do it.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to handle changed user ID
  2017-12-07 14:12 How to handle changed user ID Thomas Wolff
  2017-12-07 15:03 ` cyg Simple
@ 2017-12-07 20:08 ` Brian Inglis
  2017-12-08  0:16 ` Achim Gratz
  2 siblings, 0 replies; 5+ messages in thread
From: Brian Inglis @ 2017-12-07 20:08 UTC (permalink / raw)
  To: cygwin

On 2017-12-07 00:50, Thomas Wolff wrote:
> I had to delete a corrupted Windows account and recreate it.
> For cygwin, the new account, although with the same name, has a different
> user id.

That id is the Cygwin hash of the Windows user id registry key; compare entries
from:
	$ getent passwd ; mkpasswd

> Of course, this creates access problems for existing files (even if they 
> appear to have the same user in ls -l, because the *old user* is still listed
> in /etc/passwd).

And should be shown if you use:
	$ ls -n ...
> Is there a canonical solution to this problem, other than running 
> chown -R $USER ~ ?
> Can the new user be forced to use the previous user ID?

Have you changed all file ownerships in Windows?

Have you tried renaming your id files out of the way so that Cygwin uses SAM/AD?
	$ mv /etc/passwd{,.save} ; mv /etc/group{,.save}
I did that a couple of years ago and had no problems since.
If you uncommented any lines or made any changes to /etc/nsswitch.conf, comment
them out again, if they affect .

If that doesn't work, rename the originals out of the way, as above, and run:
	$ mkpasswd > /etc/passwd ; mkgroup > /etc/group.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to handle changed user ID
  2017-12-07 14:12 How to handle changed user ID Thomas Wolff
  2017-12-07 15:03 ` cyg Simple
  2017-12-07 20:08 ` Brian Inglis
@ 2017-12-08  0:16 ` Achim Gratz
  2 siblings, 0 replies; 5+ messages in thread
From: Achim Gratz @ 2017-12-08  0:16 UTC (permalink / raw)
  To: cygwin

Thomas Wolff writes:
> Is there a canonical solution to this problem, other than running chown
> -R $USER ~ ?

Be careful with any recursive option, it can descend into paths you
really don't want it to go.  If what you need to do is any more
difficult than just taking ownership using the new SID, I can recommend
a program called "subinacl", it's a download from Microsoft.

> Can the new user be forced to use the previous user ID?

Not that I know of, no.  A SID will never be reused.

Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf rackAttack:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-12-07 20:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-07 14:12 How to handle changed user ID Thomas Wolff
2017-12-07 15:03 ` cyg Simple
2017-12-07 16:43   ` Corinna Vinschen
2017-12-07 20:08 ` Brian Inglis
2017-12-08  0:16 ` Achim Gratz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).