This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Overriding the default HOME priority settings
- From: Andrew DeFaria <Andrew at DeFaria dot com>
- To: cygwin at cygwin dot com
- Date: Tue, 05 Apr 2005 14:49:56 -0700
- Subject: Re: Overriding the default HOME priority settings
- References: <42530114.90501@cs.caltech.edu>
Pat Cahalan wrote:
From the Cygwin FAQ:
When starting Cygwin from Windows, `HOME' is determined as follows in
order of decreasing priority:
1. `HOME' from the Windows environment, translated to POSIX form.
> 2. The entry in /etc/passwd
> 3. `HOMEDRIVE' and `HOMEPATH' from the Windows environment
> 4. /
For reasons very complex, this behavior isn't workable in my
environment. I need Cygwin's home to ALWAYS use the entry in /etc/passwd
and bypass (1).
Is this possible? I've read every scrap of documentation I can find
and I don't see anything about overriding this default behavior.
Aside from examining source code and/or digging through the system
registry (or asking this mailing list) I'm out of ideas...
IIRC $HOME is set in /etc/profile. You can easily change /etc/profile to
do what you like. What I used to do is make one /etc/profile then
everybody symlinked to it.
(background information included for those interested parties)
The CS department cluster here at Caltech is built around the concept
that *nothing* important lives on the local machine, and that
everything that needs to be backed up is stored on the central file
server.
The central file server, therefore, runs NFS and Samba. The Linux
clients automount the users' homedirectories. The Windows clients
have the same homedirectory mapped via the domain controller's
built-in ability to define %HOME% for each user account.
However, all of the UNIX dotfiles in the user's homedirectory are
configured with the assumption that the machine mounting the
homedirectory also has other NFS automounts (and is set up as one of
our standard Linux clients), which means that most of the dotfiles in
%HOME% don't make sense to Cygwin.
This is a good philosophy. Mine was similar - /etc/passwd was the source
for where $HOME is for the user. Similarly /etc/passwd was kept on the
file server and the clients symlinked to it. Unlike Real Unix where you
really have to log in and where you might be concerned that you would
not be able to log in if you were having networking problems, with
Cygwin you don't "log in" rather you are already logged in before you
ever start Cygwin. So IMHO symlinking /etc/passwd should not be a problem.
Additionally I attempted to make $HOME on Cygwin look very similar to
$HOME on Linux in that I did a mount -bsf //<fileserver>/<homeshare>
/home. Therefore on Linux the user's $HOME is /home/$USER and on Cygwin,
well, viola! It was also /home/$USER! Imagine that!
Plus with /etc/profile and /etc/passwd symlinked on the clients machine
to known locations on a file server I had 1) the master passwd and
profile files backed up (there were other /etc files done in a similar
manner - /etc/group I believe and perhaps a few others - I forget) and
2) had control to change /etc/profile to effect change across the
organization.
So to summarize:
1. Put key /etc files on file server. Symlink them to the client
machine (I had my own cygwin_setup bash script to take care of
these and other issues)
2. Change the master /etc/profile to get/set $HOME from /etc/passwd
(that is the symlinked master /etc/passwd).
3. Make sure the $HOME's path is similar to that on Linux (BTW: this
mount of //<fileserver>/<homeshare> was also done in my
cygwin_setup bash script).
(P.S. My /etc files and other things were actually in the Clearcase
admin vob and made visable as a Clearcase snapshot view).
--
Excuse me for butting in, but I'm interrupt-driven.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/