public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* How to specify the user directory OUTSIDE of Cygwin (installation folder)?
@ 2017-09-09  5:11 Ben Stover via cygwin
  2017-09-09  7:53 ` Marco Atzeri
  2017-09-09  9:39 ` Kptain
  0 siblings, 2 replies; 5+ messages in thread
From: Ben Stover via cygwin @ 2017-09-09  5:11 UTC (permalink / raw)
  To: Cygwin MailList

By default the user folder of Cygwin (under Win7) is in a subdirectory

<installation folder>\home\<username>

How can I put it into a separate directory OUTSIDE of Cygwin?

Example:

I installed Cygwin in

D:\tools\cygwin\v2\

and want to put my (resp. all) home directories into

D:\tools\cygwin\myhome\

If possible I would like to specify my new home directory not as absolute but as relative path.

I would prefer a customization somwhow in "Cygwin.bat" like:

set cygwinhome=..\myhome

Mind the double dots standing for "go up one level".

How can I achieve this?

Ben








.

--
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 specify the user directory OUTSIDE of Cygwin (installation folder)?
  2017-09-09  5:11 How to specify the user directory OUTSIDE of Cygwin (installation folder)? Ben Stover via cygwin
@ 2017-09-09  7:53 ` Marco Atzeri
  2017-09-09  8:31   ` Jürgen Wagner
  2017-09-09  9:39 ` Kptain
  1 sibling, 1 reply; 5+ messages in thread
From: Marco Atzeri @ 2017-09-09  7:53 UTC (permalink / raw)
  To: cygwin

On 09/09/2017 07:06, Ben Stover via cygwin wrote:
> By default the user folder of Cygwin (under Win7) is in a subdirectory
> 
> <installation folder>\home\<username>

from cygwin point of view "/home/<username>"

> How can I put it into a separate directory OUTSIDE of Cygwin?
> 
> Example:
> 
> I installed Cygwin in
> 
> D:\tools\cygwin\v2\
> 
> and want to put my (resp. all) home directories into
> 
> D:\tools\cygwin\myhome\
> 
> If possible I would like to specify my new home directory not as absolute but as relative path.
> 
> I would prefer a customization somwhow in "Cygwin.bat" like:
> 
> set cygwinhome=..\myhome
> 
> Mind the double dots standing for "go up one level".
> 
> How can I achieve this?
> 
> Ben
> 


mkpasswd -c >> /etc/passwd

change the fifth field of "/etc/passwd"
from  "/home/<username>"
to "/cygdrive/d/tools/cygwin/myhome"


close all cygwin process and rerun.

--
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 specify the user directory OUTSIDE of Cygwin (installation folder)?
  2017-09-09  7:53 ` Marco Atzeri
@ 2017-09-09  8:31   ` Jürgen Wagner
  2017-09-09  9:03     ` Corinna Vinschen
  0 siblings, 1 reply; 5+ messages in thread
From: Jürgen Wagner @ 2017-09-09  8:31 UTC (permalink / raw)
  To: cygwin

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

Hi,
  of course, you could change something in /etc/passwd to define a new
home directory. However, it is good to have the convention of home
directories being under one root (at least for non-administrative
accounts). Therefore, my preferred solution is to make a symbolic link.

/home/USER => /cygdrive/d/tools/...

You can have symbolic links with relative paths as a destination,
however, that would assume you still are in the directory universe of
Cygwin. In this case, you are not. Therefore, you have to address this
via /cygdrive/...

Besides... what is the advantage of having a relative path here, anyway?
If you install different flavours of Cygwin as siblings under a common
root, the absolute path will be the same for all instances.

Cheers,
--J.

On 09.09.2017 09:53, Marco Atzeri wrote:
> On 09/09/2017 07:06, Ben Stover via cygwin wrote:
>> By default the user folder of Cygwin (under Win7) is in a subdirectory
>>
>> <installation folder>\home\<username>
>
> from cygwin point of view "/home/<username>"
>
>> How can I put it into a separate directory OUTSIDE of Cygwin?
>>
>> Example:
>>
>> I installed Cygwin in
>>
>> D:\tools\cygwin\v2\
>>
>> and want to put my (resp. all) home directories into
>>
>> D:\tools\cygwin\myhome\
>>
>> If possible I would like to specify my new home directory not as
>> absolute but as relative path.
>>
>> I would prefer a customization somwhow in "Cygwin.bat" like:
>>
>> set cygwinhome=..\myhome
>>
>> Mind the double dots standing for "go up one level".
>>
>> How can I achieve this?
>>
>> Ben
>>
>
>
> mkpasswd -c >> /etc/passwd
>
> change the fifth field of "/etc/passwd"
> from  "/home/<username>"
> to "/cygdrive/d/tools/cygwin/myhome"
>
>
> close all cygwin process and rerun.
>
> -- 
> 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
>
>



[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3986 bytes --]

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

* Re: How to specify the user directory OUTSIDE of Cygwin (installation folder)?
  2017-09-09  8:31   ` Jürgen Wagner
@ 2017-09-09  9:03     ` Corinna Vinschen
  0 siblings, 0 replies; 5+ messages in thread
From: Corinna Vinschen @ 2017-09-09  9:03 UTC (permalink / raw)
  To: cygwin

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

[top-posting fixed]

On Sep  9 10:31, Jürgen Wagner wrote:
> On 09.09.2017 09:53, Marco Atzeri wrote:
> > On 09/09/2017 07:06, Ben Stover via cygwin wrote:
> >> By default the user folder of Cygwin (under Win7) is in a subdirectory
> >>
> >> <installation folder>\home\<username>
> >
> > from cygwin point of view "/home/<username>"
> >
> >> How can I put it into a separate directory OUTSIDE of Cygwin?
> >> [...]
> >> If possible I would like to specify my new home directory not as
> >> absolute but as relative path.
> >>
> >> I would prefer a customization somwhow in "Cygwin.bat" like:

We *have* extensive customization, see below.

> >>
> >> set cygwinhome=..\myhome
> >>
> >> Mind the double dots standing for "go up one level".
> >>
> >> How can I achieve this?
> >>
> >> Ben
> >>
> > mkpasswd -c >> /etc/passwd
> >
> > change the fifth field of "/etc/passwd"
> > from  "/home/<username>"
> > to "/cygdrive/d/tools/cygwin/myhome"
> >
> > close all cygwin process and rerun.

/etc/passwd should be the absolut last resort.  Preferredly the changes
are in /etc/nsswitch.conf and the user database, SAM or AD.  Here's the
howto:

  https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-mapping-passwdinfo

For instance, change /etc/nsswitch.conf to contain

  db_home: /your/desired/homedir/%U

> Hi,
>   of course, you could change something in /etc/passwd to define a new
> home directory. However, it is good to have the convention of home
> directories being under one root (at least for non-administrative
> accounts). Therefore, my preferred solution is to make a symbolic link.
> 
> /home/USER => /cygdrive/d/tools/...
> 
> You can have symbolic links with relative paths as a destination,
> however, that would assume you still are in the directory universe of
> Cygwin. In this case, you are not. Therefore, you have to address this
> via /cygdrive/...
> 
> Besides... what is the advantage of having a relative path here, anyway?
> If you install different flavours of Cygwin as siblings under a common
> root, the absolute path will be the same for all instances.

I'd suggest a mount point in /etc/fstab instead, e.g.

  C:/cygwin64/newhome /home ntfs binary 0 0

That has the additional advantage that the POSIX ACL handling is
under your control, rather than being the default noacl handling
of cygdrive paths.

Alternatively, see the /etc/nsswitch.conf customizations above.


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 specify the user directory OUTSIDE of Cygwin (installation folder)?
  2017-09-09  5:11 How to specify the user directory OUTSIDE of Cygwin (installation folder)? Ben Stover via cygwin
  2017-09-09  7:53 ` Marco Atzeri
@ 2017-09-09  9:39 ` Kptain
  1 sibling, 0 replies; 5+ messages in thread
From: Kptain @ 2017-09-09  9:39 UTC (permalink / raw)
  To: cygwin

 I suggest to reuse Windows environment variable: $USERPROFILE

 Just redefine new home directory:
setenv HOME $USERPROFILE/home (for example if you expect a folder outside
cygwin folder itself)







--
Sent from: http://cygwin.1069669.n5.nabble.com/Cygwin-list-f3.html

--
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-09-09  9:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-09  5:11 How to specify the user directory OUTSIDE of Cygwin (installation folder)? Ben Stover via cygwin
2017-09-09  7:53 ` Marco Atzeri
2017-09-09  8:31   ` Jürgen Wagner
2017-09-09  9:03     ` Corinna Vinschen
2017-09-09  9:39 ` Kptain

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