public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: How to specify the user directory OUTSIDE of Cygwin (installation folder)?
Date: Sat, 09 Sep 2017 09:03:00 -0000	[thread overview]
Message-ID: <20170909090340.GC18477@calimero.vinschen.de> (raw)
In-Reply-To: <ba377295-9abd-e48f-974b-5280f5d27f86@wagner.is>

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

  reply	other threads:[~2017-09-09  9:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-09  5:11 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 [this message]
2017-09-09  9:39 ` Kptain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170909090340.GC18477@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).