Where are default permissions for files and directories set before a umask is applied to limit those?
Or are they 0777 by default?
AFAIK it's hard-coded (in some sense) into every program that can create files. I basically agree with @Thor: it's typically 777 for directories and executable files (i.e., compilers use 777), and 666 for all others (data files, named pipes, "special" (device) files, etc.) The default mode for file-system sockets would probably have to be hard-coded in the kernel, since AFAIK the
I said "in some sense" because many programs use library functions (e.g.,
That said, it's possible that some versions of *nix have a configuration file somewhere, and some or all programs and library functions read this configuration file to get the default mode.