public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Changing user home to overlap Windows user home possible? Or a bad idea?
@ 2023-04-07 20:48 Thomas Schweikle
  2023-04-08  8:30 ` Andrey Repin
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Schweikle @ 2023-04-07 20:48 UTC (permalink / raw)
  To: cygwin


[-- Attachment #1.1.1: Type: text/plain, Size: 431 bytes --]

Hi!

Is it possible to have the same home for Windows and cygwin? Using 
"C:\Users\<user>" for Cygwin home setting mount points for users?
Or is this a bad idea? Or is it something which has some drawbacks 
you've to decide to live with? At the moment the most ugly drawback is 
duplication of various data needed within "C:\cygwin\home\<user>" and 
"C:\Users\<user>". Would be nice if I could overlay both.
-- 
Thomas


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 2521 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 321 bytes --]

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

* Re: Changing user home to overlap Windows user home possible? Or a bad idea?
  2023-04-07 20:48 Changing user home to overlap Windows user home possible? Or a bad idea? Thomas Schweikle
@ 2023-04-08  8:30 ` Andrey Repin
  2023-04-11 20:42   ` Thomas Schweikle
  0 siblings, 1 reply; 4+ messages in thread
From: Andrey Repin @ 2023-04-08  8:30 UTC (permalink / raw)
  To: Thomas Schweikle, cygwin

Greetings, Thomas Schweikle!

> Is it possible to have the same home for Windows and cygwin?

See /etc/nsswitch.conf and https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-mapping-nsswitch

> Using "C:\Users\<user>" for Cygwin home setting mount points for users?

I don't get this question. Can you please rephrase?

> Or is this a bad idea? Or is it something which has some drawbacks you've
> to decide to live with? At the moment the most ugly drawback is duplication
> of various data needed within "C:\cygwin\home\<user>" and "C:\Users\<user>".
> Would be nice if I could overlay both.

There's some caveats to using %USERPROFILE% as $HOME, most notable, you have
to be careful with overly sensitive programs, like SSH or GPG. Other than
that, the noacl flag on the cygdrive mount will cover you for the time being.
I.e.:

>> none /cygdrive cygdrive noacl,binary,nouser,posix=0 0 0

And usertemp idea is also a good one:

>> none /tmp usertemp binary,nouser,posix=0 0 0


-- 
With best regards,
Andrey Repin
Saturday, April 8, 2023 11:09:33

Sorry for my terrible english...


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

* Re: Changing user home to overlap Windows user home possible? Or a bad idea?
  2023-04-08  8:30 ` Andrey Repin
@ 2023-04-11 20:42   ` Thomas Schweikle
  2023-04-11 22:16     ` Andrey Repin
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Schweikle @ 2023-04-11 20:42 UTC (permalink / raw)
  To: cygwin


[-- Attachment #1.1.1: Type: text/plain, Size: 2337 bytes --]

Hi!

Am Sa., 08.Apr..2023 um 10:30:47 schrieb Andrey Repin:
> Greetings, Thomas Schweikle!
> 
>> Is it possible to have the same home for Windows and cygwin?
> 
> See /etc/nsswitch.conf and https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-mapping-nsswitch
> 
>> Using "C:\Users\<user>" for Cygwin home setting mount points for users?
> 
> I don't get this question. Can you please rephrase?

I've tried to set

C:/Users /home ntfs binary,posix=0,nouser 0 0

Then have "C:/Users/..." and "/home/..." the same.
Did not work this way. Starting some shell got cygwin exhaust "Could not 
create "/home/<user>" -- true: the directory was there already, but 
cygwin did not notice. Can't tell why. I could switch to /home/<user>, 
while cygwin couldn't setting $HOME to /tmp. I had success with

mklink /D C:\cygwin\home C:\Users

and then setting /etc/nsswitch.conf to

db_home: /home/%U

this did the trick: cygwin starting a shell works now as expected.
One last problem: the owner of the files was not the one expected. Could 
change him to the expected one using windows tools.

The remaining problems are all git related: git seems to have problems 
creating symlinks for clones. Maybe this is just a case enabling 
privileges via GPO for users needing them. Looks like some sources fail 
to compile if symlinks are not available.


>> Or is this a bad idea? Or is it something which has some drawbacks you've
>> to decide to live with? At the moment the most ugly drawback is duplication
>> of various data needed within "C:\cygwin\home\<user>" and "C:\Users\<user>".
>> Would be nice if I could overlay both.
> 
> There's some caveats to using %USERPROFILE% as $HOME, most notable, you have
> to be careful with overly sensitive programs, like SSH or GPG. Other than
> that, the noacl flag on the cygdrive mount will cover you for the time being.
> I.e.:

This was why I tried to mount C:\Users to /home, having two identical 
directories making ssh, gpg and others happy.

>>> none /cygdrive cygdrive noacl,binary,nouser,posix=0 0 0
> 
> And usertemp idea is also a good one:
> 
>>> none /tmp usertemp binary,nouser,posix=0 0 0

This was helpful. It is a little bit problematic switching users, but it 
is lots better than having a global /tmp for all users.
-- 
Thomas


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 2521 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 321 bytes --]

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

* Re: Changing user home to overlap Windows user home possible? Or a bad idea?
  2023-04-11 20:42   ` Thomas Schweikle
@ 2023-04-11 22:16     ` Andrey Repin
  0 siblings, 0 replies; 4+ messages in thread
From: Andrey Repin @ 2023-04-11 22:16 UTC (permalink / raw)
  To: Thomas Schweikle, cygwin

Greetings, Thomas Schweikle!

> Am Sa., 08.Apr..2023 um 10:30:47 schrieb Andrey Repin:
>> Greetings, Thomas Schweikle!
>> >> Is it possible to have the same home for Windows and cygwin?
>> > See /etc/nsswitch.conf and https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-mapping-nsswitch
>> >> Using "C:\Users\<user>" for Cygwin home setting mount points for users?
>> > I don't get this question. Can you please rephrase?

> I've tried to set

> C:/Users /home ntfs binary,posix=0,nouser 0 0

+,noacl

> Then have "C:/Users/..." and "/home/..." the same.

That's an option, but not without side-effects.

> Did not work this way. Starting some shell got cygwin exhaust "Could not
> create "/home/<user>" -- true: the directory was there already, but cygwin
> did not notice. Can't tell why. I could switch to /home/<user>, while cygwin
> couldn't setting $HOME to /tmp. I had success with

> mklink /D C:\cygwin\home C:\Users

> and then setting /etc/nsswitch.conf to

> db_home: /home/%U

> this did the trick: cygwin starting a shell works now as expected.
> One last problem: the owner of the files was not the one expected. Could
> change him to the expected one using windows tools.

But then Cygwin tools would complain.

> The remaining problems are all git related: git seems to have problems
> creating symlinks for clones. Maybe this is just a case enabling privileges
> via GPO for users needing them.

I suggest you do NOT use symlinks with git. The very idea is unstable and
error prone.
Other than that, it depends, which sources and which symlinks you are using.

> Looks like some sources fail to compile if symlinks are not available.


>>> Or is this a bad idea? Or is it something which has some drawbacks you've
>>> to decide to live with? At the moment the most ugly drawback is duplication
>>> of various data needed within "C:\cygwin\home\<user>" and "C:\Users\<user>".
>>> Would be nice if I could overlay both.
>> There's some caveats to using %USERPROFILE% as $HOME, most notable, you have
>> to be careful with overly sensitive programs, like SSH or GPG. Other than
>> that, the noacl flag on the cygdrive mount will cover you for the time being.
>> I.e.:

> This was why I tried to mount C:\Users to /home, having two identical
> directories making ssh, gpg and others happy.

No. That will NOT make gpg and ssh happy.
Quite the opposite, using noacl mount as default home, ssh and gpg will
complain about incorrect permissions on their configuration directories.
Or, if you do not mount users root with noacl, Cygwin will attempt to treat
profile as POSIX directory, potentially wreaking havoc on files and
directories for Windows programs not expecting such surprise.

What I did, I made a symlink to /home/$user/.{gnupg,ssh} in my profile
directory. Thus the permissions on the respective directories are matching the
POSIX standard, but parent directory (profile) permissions do not affect them.

>>>> none /cygdrive cygdrive noacl,binary,nouser,posix=0 0 0
>>  And usertemp idea is also a good one:
>>>> none /tmp usertemp binary,nouser,posix=0 0 0

> This was helpful. It is a little bit problematic switching users, but it is
> lots better than having a global /tmp for all users.


-- 
With best regards,
Andrey Repin
Wednesday, April 12, 2023 00:59:45

Sorry for my terrible english...


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

end of thread, other threads:[~2023-04-11 22:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-07 20:48 Changing user home to overlap Windows user home possible? Or a bad idea? Thomas Schweikle
2023-04-08  8:30 ` Andrey Repin
2023-04-11 20:42   ` Thomas Schweikle
2023-04-11 22:16     ` Andrey Repin

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