# Setting umask for a jail process user



## raidoh (Jul 13, 2015)

I'm trying to solve why a jail process is writing files as 022 mask and how to set it to 007 to allow rwx:rwx:--- for group permissions among a set of users writing to the same directories/files. The user account is only for running the process. So, I'm hoping to find some advice on how to set the umask for a process user (no login) in FreeBSD. 

I'm running FreeNAS 9.3 with a BT sync Plugin in a jail. I did read that FreeNAS is an unsupported FreeBSD derivative, but I've posted both at FreeNAS (link) and BT sync (link) forums without finding a solution, so I figured I'd pose the question from a more general FreeBSD perspective. 

Having setup the storage using `chmod -R g+s .`the groups are being assigned properly no matter which user creates the file, but the file permissions are 644 (instead of the desired 660), so not writable by other users within the group. Within the jail, I've tried setting the umask in /etc/login.conf (then running `cap_mkdb /etc/login.conf`) as well as in /usr/local/etc/rc.d/btsync and /etc/rc.conf, but they didn't seem to work. I've been trying `umask 007` and a few other variants like `umask 0007`, `umask=007` just to be thorough, but perhaps that's incorrect? 

Thanks.


----------

