This is the mail archive of the cygwin-developers mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: setup/mkpasswd and HOMEDRIVE/HOMEPATH


Corinna Vinschen wrote:
On May 7 00:44, Larry Hall (Cygwin Developers) wrote:
Dave Korn wrote:
Larry Hall (Cygwin Developers) wrote:
I was basically thinking of the pathelogical case where the user
doesn't have permissions to create or access the home directory
due to some strange phenomena (somebody messed up permissions,
'/home/<user>' points to a shared drive that's inaccessible, etc.).
  I was thinking of that too, but I'd hardly call it 'pathological'.  It's
standard practice on Linux for /home to be owned by root and only have r-x
perms for everyone else, as root is the only one who should be adding new
users and hence the only person who should be creating dirs in /home.

  In cygwin we're effectively letting non-admin users control most of the
'adduser' behaviour themselves.  Someone might easily think that chmod'ing
/home 755 was a good idea.
Right.

And as to the terminology, let's call them "corner cases" instead so no one
gets hung up on semantics. :-)

But how's that supposed to work? Right now (and also in the former code) Cygwin doesn't (and didn't) check for any directory permissions. Evaluating the home directory is just a question of where to get the information from

<a very useful/helpful description of new/old setup behavior relative to the home directory snipped for brevity>

Back to the / fallback.

Right now, what happens is this:

If /home/$USER exists, but cd to it fails due to missing permissions,
the shell will end up in the former current directory.  This is typically
/bin or /usr/bin.

Right.


If /home/$USER does not exist, the /etc/profile mechanism kicks in.
If /home does not have sufficient permissions for the user to create
his/her own home dir, something like this will happen:

  mkdir: cannot create directory `/home/corinna': Permission denied
  /home/corinna could not be created.
  Setting HOME to /cygdrive/c/Users/corinna/AppData/Local/Temp.

When not using bash, but tcsh, the following happens:

  mkdir: cannot create directory `/home/corinna': Permission denied
  cd: Can't change to home directory.
  [/usr/bin]$

I don't see anything wrong with this behaviour.  Maybe /etc/profile
should choose / rather than $TEMP as fallback HOME dir?  And maybe tcsh
should align its behaviour and set HOME to / as well if mkdir fails to
work?

I agree there's nothing wrong with the behavior in the cases you described above. It might be a "good thing"(tm) to have the "don't know/can't access" case always use /. I wouldn't say that it's worth doing back-flips to achieve though. It may not even be worth mild effort. ;-)

What other pathological case am I missing?

Actually, I think this covers the general category of home directory inaccessibility behavior. Dave, anything else you see?

--
Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
216 Dalton Rd.                          (508) 429-6305 - FAX
Holliston, MA 01746


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]