Xref: utzoo comp.unix.questions:28860 comp.unix.ultrix:6292 Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!uunet!bria!mike Newsgroups: comp.unix.questions,comp.unix.ultrix Subject: Re: Pre-set file permissions Message-ID: <467@bria> Date: 18 Feb 91 17:36:49 GMT References: <509@anselm.UUCP> Reply-To: uunet!bria!mike Followup-To: comp.unix.questions Organization: MGI Group International, Los Angeles, CA Lines: 28 In an article, anselm.UUCP!ebertran (Erik S. Bertrand) writes: >I would like to know if there is such a way to preset (say, in a .login file) >file permissions so that each time a file is saved, it's permissions will be >those of the preset ones. Thank you in advance for your reply. Set the umask to the permission bits that you want turned _off_ when a file is created; a common umask is 022. To set the umask, simply use the umask(1) command, such as ``umask 022''. Whenever you create a file, the creat() call gets your file creation mask from your U area, and does something like this: creat(path,mode) char *path; int mode; { struct user *u; ... mode &= ~(u->u_cmask); ... } Cheers, -- Michael Stefanik, MGI Inc., Los Angeles| Opinions stated are not even my own. Title of the week: Systems Engineer | UUCP: ...!uunet!bria!mike ------------------------------------------------------------------------------- Remember folks: If you can't flame MS-DOS, then what _can_ you flame?