Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbosgd!gatech!ut-sally!std-unix From: std-unix@ut-sally.UUCP (Moderator, John Quarterman) Newsgroups: mod.std.unix Subject: Re: umask per dir Message-ID: <4130@ut-sally.UUCP> Date: Thu, 6-Feb-86 08:15:56 EST Article-I.D.: ut-sally.4130 Posted: Thu Feb 6 08:15:56 1986 Date-Received: Fri, 7-Feb-86 21:31:33 EST References: <4118@ut-sally.UUCP> Reply-To: dupuy@garfield.UUCP (Alexander Dupuy) Organization: IEEE/P1003 Portable Operating System Environment Committee Lines: 55 Approved: jsq@sally.UUCP Date: Thu, 6 Feb 86 06:06:25 EST >From: Alex Dupuy Organization: Columbia University In <4103@ut-sally.UUCP> std-unix@ut-sally.UUCP (John Quarterman) writes: > > The more interesting question is *how* do you set a umask on a directory? Do > you try to derive the bits from the directory mode bits in some way? ... And > how do you get the umask inherited by child directories? > > I would think the preferred approach would be to somehow derive the umask > from the directory mode bits. Inheriting could be done by just setting the > umask for all the subdirectories with find. Except that mkdir should likely > make sure the umask were inherited. Having primarily used bsd Unix for a few years, and before that, Twenex, which has default file protections on a per-directory basis, I would agree that keeping the protection masks in the directory tree is better than the Unix's umask. Still, as some have pointed out, for reasons of compatibility with tar and cpio, adding information to the directory structures would be a mistake. Also, switching over to a purely directory based umask would cause security problems with existing programs expecting umask to work properly. A directory/process based umask scheme which provides compatibility with the normal Unix filesystems, and allows naive programs to operate securely (when opening files in /tmp or /usr/tmp, say) is still possible, and would provide a more flexible mechanism than the common directory based systems. It might work like this: The setuid and setgid bits in the mode of a directory would be used to specify which logical combination of umask and directory mode access bits should be used as the mask when creating files or directories. The logical combinations would be 00 mask = umask 01 mask = umask | ~directory mode 10 mask = umask & ~directory mode 11 mask = ~directory mode Users would set their umasks much as they do now, to cover the default case. Directories like /tmp would be set 00 for security compatibility, while mail directories would be set 01 for greater protection, project directories would be set 10 to ensure that files and subdirectories were group writable, and home directories might be set 11. For the benefit of really paranoid programs/users, two bits could be added to the umask to override the directory combination bits, although doing so would add to the complexity of the system without really increasing security or flexibility. @alex Volume-Number: Volume 5, Number 41