How to specify the user directory OUTSIDE of Cygwin (installation folder)?
Corinna Vinschen
corinna-cygwin@cygwin.com
Sat Sep 9 09:03:00 GMT 2017
[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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20170909/87a01523/attachment.sig>
More information about the Cygwin
mailing list