Jenkins on Ubuntu - Multiple (Related) Issues

I run Hardy Heron and Jenkins 1.429 installed manually (i.e. the downloaded package and installed, and not through the usual instructions here Install Jenkins on Ubuntu due to error 302.

Background. I am inexperienced with both Ubuntu and Jenkins. I am entrusted with setting up what I consider the β€œcore” Jenkins core to create two Java Maven projects and, ultimately, a C ++ project. We use Synergy CM as SCM, for which I installed the unreleased Synergy plugin for Jenkins (I downloaded the code and built it myself). Jenkins has no security at this time.

My problem is that during the build it is impossible to access the source tree directory tree (for example, to delete the target folder during the clean phase). This seems to be due to the fact that the user "jenkins" does not own the source directories, but rather my build manager user (the first Ubuntu user created).

How do i solve this? My thoughts originally

1. Change of ownership of a directory tree

OR

2. Obtain user rights, ie Run tasks as the user of the assembly manager who owns the directories. I read threads about running Jenkins (or tasks) as another user, but it seems I'm getting lost along the way.

3. I don’t even see the jenkins user created during the installation of the Jenkins package, when I run the user admin tool, but if I try to add the jenkins user, it will tell me already.

Sorry if this is a newbie question, but would like to know how to do it right. Thanks in advance.

Edit: I run Jenkins as the default daemon.

Edit 2: "How can the first take things that are not available to the second?" I get what you say and you are right, I checked the code through another user, and did not allow the jenkins user to do this. But I still need to run the assembly as a user of my assembly, unless I make the jenkins user just like my assembly user, which involves invoking the jenkins user created in a UNIX box that starts the Synergy server and possibly other things. I would rather just run the build as this user if I can. I tried adding the line JENKINS_USER=myuser with no luck, and also changing DAEMON_ARGS=--name=jenkins ... to be my user, not "jenkins".

+4
source share
3 answers

Basically you will need to change JENKINS_USER in the file / etc / default / jenkins, as said in bmargulies. This sets which user will be used to run jenkins. If you do this and restart jenkins, nothing will work, so you need to run chown on some directories for the new user:

 chown -R <user>:<group> /var/run/jenkins/war chown <user>:<group> /var/log/jenkins chown <user>:<group> /etc/init.d/jenkins chown <user>:<group> /etc/default/jenkins 

I think that the most important thing is that the log has the correct resolution, so you can check the log for errors if it does not start ;-) The bad news is that right now, if you update jenkins from the repository, it will overwrite the permissions, and you will need to do chow-tan after each update. I think there is a bug report for this, so maybe they will fix it soon.

Hope this helps.

+5
source

I also had to chmod several other ways on my:

 /var/lib/jenkins /var/cache/jenkins /var/run/jenkins 
+5
source

If you follow the instructions, you have /etc/init.d/jenkins . And there is a place to set the username that you want to run as.

In addition, to find out which users you really have, you just have to look at /etc/passwd , and not get into any gui shell or another.

However, none of this makes sense if you do not have NFS participating in the workspace directory. Regardless of which user Jenkins is running, this user runs SCM validation and then builds, since you can grab things that are not available to the latter first?

In any case, ls -l is your friend, seeing who actually owns what and which modes.

+2
source

All Articles