I have a number of services on an Ubuntu 12.04 server and I'm making each of them run under their own user account instead of running under my account (for improved security as well as seeing which applications are consuming the most resources).
One of my services (we'll call this application-foo) downloads a file and saves it locally to a Downloads folder in my home directory. Another service (we'll call this application-bar) then finds the downloaded file and moves it to another location.
user-foo downloads the file using application-foo
user-bar moves the downloaded file using application-bar
Both user-foo and user-bar are members of the downloads group
The downloaded file is sent to:
That Downloads folder has permissions set to 775 with kris:downloads as the owners. I've set the user and group to be sticky bits.
When user-foo finishes downloading a file and puts it to my Downloads folder, it's setting the permissions as:
This is a problem because user-bar is part of the downloads group, and since that file now does not have write permission on the group, user-bar is unable to delete the file after moving it.
I've tried creating a .profile file and setting umask=002 for /home/user-foo, but that didn't work. I've also tried setting a global umask value in /etc/profile and /etc/login.defs (which didn't work either).
I even tried using setfacl to make the g::rwx and g:downloads:rwx, but that didn't change anything.
What am I missing?
Just to add, if I log in as this user (sudo su user-foo), enter my /home/kris/Downloads directory, and create a new directory (mkdir test), the created directory has permissions set correct at 775. But for whatever reason, when application-foo creates the directory, it's setting the permissions incorrectly at 755.