Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to allow jenkins to access the files that only root or some specific programs have access to?

What I'm basically trying to do is allow jenkins access my android-sdk-linux folder and all the sub-directories. My boss does not want to change permissions on the folder himself. I am supposed to do it during the build process. I have seen some examples that run some commands in the execute shell during the build process. Is there some commands that can I can run in that execute shell so that jenkins can have read write and execute authority on my android-sdk-linux folder?

like image 495
tanzeelrana Avatar asked Jun 13 '13 20:06

tanzeelrana


People also ask

How do I give Jenkins root permissions?

You need to use sudo to perform tasks with root privileges in Jenkins. For this, you need to enable passwordless-sudo on the App servers. To enable passwordless-sudo, you need to perform the following steps: SSH to the specific server.

How do I switch users in Jenkins?

If you haven't installed Jenkins in your local server, go to the appropriate URL and access your dashboard by using your login credentials. You will now see options to create and add user in Jenkins and manage current users. Enter Jenkins add user details like password, name, email etc.


1 Answers

As bcolfer said, you should be able to just run your shell commands with "sudo" in front of it. You will want to be sure that the user that started the Jenkins slave is a sudoer.

As root, run "visudo", this will open the /etc/sudoers file. At the bottom add a line similar to this if it is not a current sudoer:

jenkins        ALL=(ALL)       NOPASSWD: ALL

"Jenkins" being the user that started the slave.

OR

You could try adding the user to the group that owns that directory. IF you run "ls -l" you should be able to see the permissions and then the user, and the group that owns the directory. Once you know the group, as root run:

usermod -a -G group Jenkins

"Jenkins" being the user that started the slave, and "group" being the actual group name.

like image 185
kthieling Avatar answered Nov 15 '22 04:11

kthieling