Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

umask(2) [osx man page]

UMASK(2)						      BSD System Calls Manual							  UMASK(2)

umask -- set file creation mode mask SYNOPSIS
#include <sys/stat.h> mode_t umask(mode_t cmask); DESCRIPTION
The umask() routine sets the process's file mode creation mask to cmask and returns the previous value of the mask. The 9 low-order access permission bits of cmask are used by system calls, including open(2), mkdir(2), mkfifo(2), and mknod(2) to turn off corresponding bits requested in file mode. (See chmod(2)). This clearing allows each user to restrict the default access to his files. The default mask value is S_IWGRP | S_IWOTH (022, write access for the owner only). Child processes inherit the mask of the calling process. RETURN VALUES
The previous value of the file mode mask is returned by the call. ERRORS
The umask() function is always successful. LEGACY SYNOPSIS
#include <sys/types.h> #include <sys/stat.h> The include file <sys/types.h> is necessary. SEE ALSO
chmod(2), mkdir(2), mkfifo(2), mknod(2), open(2), compat(5) STANDARDS
The umask() function call is expected to conform to IEEE Std 1003.1-1988 (``POSIX.1''). 4th Berkeley Distribution June 4, 1993 4th Berkeley Distribution

Check Out this Related Man Page

umask(2)							System Calls Manual							  umask(2)

umask - Sets and gets the value of the file creation mask SYNOPSIS
#include <sys/types.h> #include <sys/stat.h> mode_t umask ( mode_t cmask ); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: umask(): POSIX.1, XPG4, XPG4-UNIX Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the value of the file mode creation mask. DESCRIPTION
The umask() function sets the file mode creation mask of the process to the value of the cmask parameter and returns the previous value of the mask. The cmask parameter is constructed by logically ORing file permission bits defined in the sys/mode.h header file. Whenever a file is created (by the open(), mkdir(), or mknod() function), all file permission bits set in the file mode creation mask are cleared in the mode of the created file. This clearing lets users restrict the default access to their files. The mask is inherited by child processes. RETURN VALUES
Upon successful completion, the previous value of the file mode creation mask is returned. RELATED INFORMATION
Commands: chmod(1), mkdir(1), Bourne shell sh(1b), POSIX shell sh(1p), umask(1) Functions: chmod(2), mkdir(2), mknod(2), open(2), stat(2) Standards: standards(5) delim off umask(2)
Man Page

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

file permission retention via ftp

Working out of AIX 4.3's . have machine (a) and machine (b) umask on both machines is 'umask 022'. as user root (these are trivial machines hence dummies like me have root access) when i Ftp files from a to b , why is it that I loose the original file permissions. After the ftp I have to chmod... (1 Reply)
Discussion started by: buRst
1 Replies

2. AIX

list of default umask by user

Hi, Do you know if it's possible to have the user list with their umask on AIX system ? I need to check if they are OK but with smit and user by user, it will take all the day. :) An idea ? Thx a lot. (3 Replies)
Discussion started by: Zlikos
3 Replies

3. UNIX for Advanced & Expert Users

How to retain file permissions during FTP on Solaris 5.9 ?

Hi All, I am trying to ftp a file : -rw-rw-rw- 1 oraclepbdw dba filename.txt from Machine A ( where umask is 022) to Machine B (umask 022) but the file changes to -rw-rw-r-- 1 ftpamle3 ftaml filename.txt Dur some constraints the group of the users on either side... (3 Replies)
Discussion started by: gauravsachan
3 Replies

4. UNIX for Dummies Questions & Answers

UMASK setting

How can we set the Sticky bit in the umask itself. Please help me :confused: I tried to set like umask 1000 but when I run umask, the value of umask is 00 (0 Replies)
Discussion started by: geniman2004
0 Replies

5. UNIX for Advanced & Expert Users

umask question

I use following code #include <fcntl.h> #define RWRWRW (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) int main(void){ umask(0); create("foo",RWRWRW); umask(S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); create("bar",RWRWRW); exit(0); } the result is follows: $umask... (2 Replies)
Discussion started by: konvalo
2 Replies

6. AIX


How do I change the umask for a NIS user? Thanks steve (1 Reply)
Discussion started by: steve.lavoie
1 Replies

7. Red Hat

Changing system-wide for umask

Hi everybody, How can I change the default UMASK for non root users, e.g. I want the umask for every new created user will be 0044. Thanks (6 Replies)
Discussion started by: leo_ultra_leo
6 Replies