Setting the umask of the jenkins process

2019-06-16 12:40发布

问题:

Our jenkins CI server (v1.499) runs tests that call URLs on the CI machine. The applications behind those URLs change the same temporary files as the unit test processes change, so those files need to be group writable. I fixed that for apache already, but totally fail with jenkins.

Modifying /etc/default/jenkins to include an umask 002 command does not help. I'm checking that with gdb after restarting the service.

So how can I change jenkins' umask setting?

回答1:

Set the umask by configuring the daemon, just add --umask=002 to the daemon args in /etc/init.d/jenkins:

DAEMON_ARGS="--name=$NAME --inherit --env=JENKINS_HOME=$JENKINS_HOME --output=$JENKINS_LOG --pidfile=$PIDFILE --umask=002"


回答2:

I had the same problems on Ubuntu 12.04.5

It seems they have changed the standard umask from 022 to 027 for more security

https://www.mail-archive.com/jenkinsci-commits@googlegroups.com/msg30397.html

So I have switched it back in my setup by changing /etc/default/jenkins to have UMASK=002 That solved my problem, maybe you did set it wrong, or forgot to restart jenkins.

Check the umask of the running deamon

ps ax | grep jenkins | grep umask



回答3:

If these tests run with Ant then you could try setting the umask in the ~/.antrc file which gets invoked on Ant's startup.