What are the conventional file permissions per filetype before umask is applied

chmodpermissionsumask

I am looking for a list that specifies the conventional file permission of all the different file-types before the umask is applied.

I read in man 1p touch that the default for a regular file is:

    S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH

I will also go off on a limb and surmise the default for a directory and symlink is:

   S_IRWXU | S_IRWXG | S_IRWXO

However I cannot find in the man pages for stat.h or mknod.h / mknod what the default permissions of Sockets, FIFOs, Block devices, and Char devices are. Are they they same as regular files? Or have I missed a man page that explains this?

Best Answer

You seem to have got it pretty well figured out; it is discussed a bit more here.  The one point that you may have missed is that you found the statement in the man page for touch(1) and not creat(2), because (with the possible exception of symbolic links), there are no system-level defaults — each program has its own individual default.  It just so happens that most (if not all) programs follow the same rules.

Related Question