-1

I have a user jenkins that creates files and folders in (on ubuntu) :

/var/jenkins/workspace/my-project

e.g:

drwxr-xr-x 2 jenkins jenkins   4096 Mar 21 16:41 ./
drwxr-xr-x 8 jenkins jenkins   4096 Mar 21 16:42 ../
-rw-r--r-- 1 jenkins jenkins 545865 Mar 21 16:41 config/
-rw-r--r-- 1 jenkins jenkins 545147 Mar 21 16:40 1.zip

Now I need my tomcat6 user to read files from the config folder. If I manually do:

sudo chown -R tomcat6:tomcat6 config

Before starting tomcat it works. But how do I permanently give tomcat permissions to read and even write to the config folder?

As suggested I am now trying to put the tomcat6 user in the jenkins group using vigr: http://linux.die.net/man/8/vigr

running vigr -g give me (just a snippet):

messagebus:x:106:
jenkins:x:1001:
puppet:x:107:
tomcat6:x:108:

But am not sure how I add then tomcat6 user to the jenkins group

closed as off-topic by Jenny D, Ward, dawud, colealtdelete, Scott Pack Mar 23 '14 at 16:10

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must demonstrate a minimal understanding of the problem being solved. Try including attempted solutions, why they didn't work, and the expected results. See How can I ask better questions on Server Fault? for further guidance." – Jenny D, Ward, dawud, colealtdelete, Scott Pack
If this question can be reworded to fit the rules in the help center, please edit the question.

  • If the files are now own by tomcat itself what is the problem ? youprobably find the best way to give tomcat the right to read the files – Kiwy Mar 21 '14 at 14:55
  • How to I give tomcat6 user rights to read the files/folders own by jenkins user? – u123 Mar 21 '14 at 14:58
  • sudo chown -R tomcat6:tomcat6 config does that work ? – Kiwy Mar 21 '14 at 14:59
  • Jep as I described that works fine. But that folder is deleted and created each time I run my job and then jenkins owns it again. – u123 Mar 21 '14 at 15:03
  • here is what should look like your /etc/group: messagebus:x:106: jenkins:x:1001:tomcat6 puppet:x:107: tomcat6:x:108: – Xinity Mar 21 '14 at 16:13
2

hy,

the easiest way (and probably the worst) is to put the user tomcat6 in the jenkins group. as all users in jenkins have permission to read in your description: drwx***r-x***r-x 2 jenkins jenkins 4096 Mar 21 14:30 config/

to achieve that, look at vigr which is a vi wrapper to edit /etc/group file

hope this helps,

  • If for some reason that is not doable, do man setfacl. – Jenny D Mar 21 '14 at 14:56
  • if directory is deleted then recreated automatically, posix acls won't last. beside posix acls are a bit trickier to use i think in his case :) – Xinity Mar 21 '14 at 16:16
  • An ACL on the parent directory will be inherited, though. – Jenny D Mar 21 '14 at 17:07

Not the answer you're looking for? Browse other questions tagged or ask your own question.