delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/03/01/16:56:35

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-ID: <36DB0B4F.8FC8757@ibm.net>
Date: Mon, 01 Mar 1999 16:49:03 -0500
From: John Fortin <fortinj AT ibm DOT net>
X-Mailer: Mozilla 4.05 [en] (WinNT; U)
MIME-Version: 1.0
To: Sebastien Barre <Sebastien DOT Barre AT utc DOT fr>
CC: cygwin AT sourceware DOT cygnus DOT com
Subject: Re: [HELP] stat(), file permission, r/w access : i'm LOST :(
References: <36DA3AD8 DOT 2047C010 AT uni-duesseldorf DOT de>
<4 DOT 1 DOT 19990301024703 DOT 01bbe6d0 AT mail DOT club-internet DOT fr> <4 DOT 1 DOT 19990301211226 DOT 016b1250 AT mail DOT club-internet DOT fr>

I think I said this before...  I had the same problem.  It has to do ( it seems ) with
being part of the administrator group.  NT assigns the owner of the file to 544 if you
are part of the administrator group.

Try this if you like.  Create a new user and set it up like your normal on EXCEPT don't
make it part of the adminstrator group.  You may need to set up some different
directories to mirror what you have now but owned by the new userid.  Try your build
there.

Sebastien Barre wrote:

> Dear cygwin people
>
> As some of you might have noticed (sorry for the flood), I'm still trying
> to arbitrate The Fight between Perl 5.002 and cygwin32-B20.1 (the
> battlefield being NT4/SP4). Well, thanks to some of you, I nearly did it
> (and also ruined a couple of nights), but a strange problem lead me to some
> more confusion :
>
> Problem : although I'm working as single user on a standalone workstation,
> and always logged as sysadmin ("administrateur" in french), cygwin seems to
> see/create the files on my hard disk as *not* belonging to me, but to
> another "being" (which is not obvious to me).
>
> I'll do my best to describe it (it's really *easy* to observe) : let's have
> a look at a simple Perl example, then a short C example with stat(), and my
> /etc/passwd and /etc/group. Finally I will create a simple file with
> 'touch', and you will notice that it will be reported as NOT belonging to
> me and not being writable :((
>
> Note : this seems specific to NT, which is not surprising regarding file
> permissions.
>
> Perl example :
> ----------------------
>
> Note : I created /etc/passwd and /etc/group with 'mkpasswd -l' and 'mkgroup
> -l' respectively, as reported in many FAQS.
>
> administrateur [26] /etc$ perl -e 'print "yes" if -w "group";'
>
> administrateur [27] /etc$ ll
> total 7
> -rw-r--r--   1 544 Aucun          27 Feb 26 02:45 group
> -rw-r--r--   1 544 Aucun         65 Mar  1 21:08 passwd
> -rw-r--r--   1 544 Aucun        9828 Dec  1 14:00 termcap
>
> That command (-w) will display 'yes' if the file (here, /etc/group) is
> writable. Apparently, it fails. And fails everywhere in my filesystem. The
> '-w' command is using C<stat>, let's move on :
>
> C example :
> ----------------------
> #include <sys/stat.h>
> #include <stdlib.h>
>
> int main() {
>     struct stat mystat;
>
>     stat("group", &mystat);
>
>     printf("mode : %o, uid : %u, gid : %u\n",
>            mystat.st_mode, mystat.st_uid, mystat.st_gid);
>
>     exit(0);
> }
>
> Run :
>
> administrateur [52] /etc$ gcc mystat.c
>
> administrateur [53] /etc$ a.exe
> mode : 100644, uid : 544, gid : 513
>
> administrateur [55] /etc$ ll group
> -rw-r--r--   1 544 Aucun          27 Feb 26 02:45 group
>
> Which means :
>         - /etc/group belongs to user which UID is 544, and to group which GID is 513
>         - it's a regular file (100000),
>         - read/write permission to owner (600), read permission to group (40) and
> read to other (4).
>
> BUT (and it drives me crazy). I CREATED that file, and I'm NOT user 544 !
> (more about this strange fellow below).
>
> administrateur [56] /etc$ whoami
> administrateur
>
> administrateur [74] /etc$ cat passwd
> Administrateur::500:513:seb::/bin/sh
> InvitÚ::501:513:::/bin/sh
>
> administrateur [75] /etc$ cat group
> Aucun::513:
> Everyone::0:
>
> Obviously, I'm user 500 (I changed my name to 'seb' so that to check).
> => Therefore WHY are all files created as 544 (even with tar) ? (the group
> is correct : 513).
>
> I thought it was related to /etc/passwd, but I just do NOT UNDERSTAND the
> difference between -l and -g option for 'mkpasswd'.
>
>    -l,--local              print local accounts
>    -g,--local-groups       print local group information too
>
> administrateur [77] /etc$ mkpasswd -l
> Administrateur::500:513:seb::/bin/sh
> InvitÚ::501:513:::/bin/sh
>
> administrateur [79] /etc$ mkpasswd -g
> Administrateurs::544:0:::
> Duplicateurs::552:0:::
> InvitÚs::546:0:::
> OpÚrateurs de sauvegarde::551:0:::
> Utilisateurs::545:0:::
> Utilisateurs avec pouvoir::547:0:::
>
> => who are these users ?!? these should be groups !! I'm belonging to the
> "Administrateurs" group for NT (in the "Gestionnaire d'utilisateurs" ~=
> "User manager"), and this has been translated to a user, I'm completely
> lost :((
>
> => dumping 'mkpasswd -l -g' to /etc/passwd (instead of 'mkpasswd -l') did
> NOT help.
>
> Here is the same joke :
>
> administrateur [84] /etc$ touch test
>
> administrateur [85] /etc$ ll test
> -rw-r--r--   1 544      Aucun           0 Mar  1 21:46 test
>
> administrateur [86] /etc$ perl -e 'print "yes" if -w "test";'
> administrateur [87] /etc$
>
> WOAH : I created a file, and it's automatically assigned to someone else !
> Give me my file back please :(
> And of course, although I created it, it's now NOT writable for cygwin.
>
> I guess I might be just dumb. Any help would be really appreciated (by my
> mental health).
>
> Thanks
>
> ______________________________________________________________
> Sebastien Barre                  http://www.hds.utc.fr/~barre/
>
> --
> Want to unsubscribe from this list?
> Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com




--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019