Ubuntu – How to change umask mode permanently

permissionsumask

I've read a couple of articles like this old one how to change umask mode but still can't figure it out 100% I have Ubuntu 14.04 running with Xenial kernel with default umask 0002 and my aim is to set 0027 umask mode permanently all across the system. How do I make it happen? What be the best way to do so?

Best Answer

A simple man -k umask should have led you to reading man pam_umask, whish says, in part:

DESCRIPTION
pam_umask is a PAM module to set the file mode creation mask of the
current environment. The umask affects the default permissions assigned
to newly created files. 

It also says,

The PAM module tries to get the umask value from the following places
   in the following order:

   ·   umask= argument

   ·   umask= entry in the user's GECOS field

   ·   UMASK= entry from /etc/default/login

   ·   UMASK entry from /etc/login.defs (influenced by USERGROUPS_ENAB in
       /etc/login.defs)