Pre-set file permissions

uunet!bria!mike uunet!bria!mike
Tue Feb 19 04:36:49 AEST 1991


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?



More information about the Comp.unix.questions mailing list