mkdir and access(2)

Dominick Samperi samperi at marob.MASA.COM
Tue Mar 29 01:07:52 AEST 1988


In article <4190 at chinet.UUCP> les at chinet.UUCP (Leslie Mikesell) writes:
|>Real-life example:
|>I have a subdirectory tree that I need to duplicate on another machine
|>via uucp.  To save transmission time, I like to use:
|>find . -print |cpio -oc |compress | uux - "remote!unpackit"
|>  where remote is the machine name and unpackit is a shell script
|>  that goes to the right place and runs zcat|cpio -imd on its input.
|>
|>Now, one would think that these files and directories would be owned
|>by uucp since uuxqt is setuid to uucp.  However, if the particular
|>run of uucico that delivered the batch was started by a user on the
|>remote machine, guess who owns the newly created directories...
|>Cpio uses system(mkdir) which gives the directory to the real
|>user which happens to be the one who originally started the process
|>(even in SysVr3 where it doesn't have to!).  Even if the first
|>run operates as uucp (due to our system logging in to deliver the
|>file) later attempts may fail due to incorrect permissions when
|>creating a new dirctory.
|>  -Les
|>             ...ihnp4!chinet!les

This is precisely the problem that motivated me to write the (slightly)
enhanced version of mkdir that I recently posted to comp.unix.wizards. It
has a -g flag which causes mkdir to use the process EFFECTIVE group id
when it makes directories. You will have to modify cpio so that it
calls mkdir with the -g flag, and so that it always gives rwx access to
a particular group, like uucpio.
-- 
Dominick Samperi, Manhattan College, NYC
    manhat!samperi at NYU.EDU           ihnp4!rutgers!nyu.edu!manhat!samperi
    philabs!cmcl2!manhat!samperi     ihnp4!rutgers!hombre!samperi
              (^ that's an ell)      uunet!swlabs!mancol!samperi



More information about the Comp.unix.questions mailing list