I know there's a ton of questions about this topic but I'm not being able to find the right answer. I have GNOME Version 3.22.2 running on a Debian GNU/Linux 9 (stretch) 64-bit.
The problem:
I'm trying to set up a shared folder (say thefolder) such that multiple users of a group (say thegroup) on the same machine can work on it. To do that I changed the ownership of the folder to thegroup and set the setgid bit of the folder.
$ ls -l
drwxrwsr-x 6 me thegroup 4096 Oct 1 20:29 thefolder
The only problem now is that the default umask in Debian is 0022 and this prevents other users to write on any subfolders or files that I create on thefolder.
What I've done so far:
My first (naive) try was to set the umask in one of the shell configuration files. I added the line
umask 0002in all of the files
/etc/profile,/etc/bash.bashrc,~/.profileand~/.bashrc(each one at a time obviously) until I realized that this worked only for the shell (GNOME Terminal and TTYs) but not for other applications like Files or Gedit. I then deleted all these lines and tried something else.I added the line
session optional pam_umask.so usergroupsat the end of the file
/etc/pam.d/common-sessionand restarted the computer. It is worth noting at this point that the optionsUMASK 022andUSERGROUPS_ENAB yesare both enabled in the/etc/login.defsfile. Having done that I noticed that the umask was correctly set as 0002 for TTYs but not for the GNOME session (the GNOME Terminal and all other programs accessed through the graphical interface still worked with a 0022 umask)After that I tried to set the umask in the Xsession script of the GNOME Display Manager. I wrote the line
umask 0002at the begining of the file
/etc/gdm3/Xsessionbut the problem persisted. I made a little experiment and wrote instead the following lineecho "umask: $(umask)" > $HOME/Desktop/debugand after log out and log in again the
debugfile contained the lineumask: 0002which means that at that point the umask was still correct and that it is overwritten somewhere else after the Xsession script.
The question
Can someone explain to me where is the umask for the GNOME session defined and how can I change it?