-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

u123
  • 267
  • 1
  • 8
  • 24
  • 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

1 Answers1

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,

Xinity
  • 184
  • 1
  • 4