Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jenkins build failure shell command permission denied

Tags:

shell

jenkins

I am trying to run shell build command on mac but I get permission denied for e.g. ls /Users/... command.

I see whoami is jenkins, which is different for my uesr login?

I read online I need to run chmod for jenkins user, how do I do that?

I changed file permission using chmod 777?

Do I need to change jenkins user?

like image 934
user2661518 Avatar asked Jun 19 '16 02:06

user2661518


2 Answers

Maybe you have a problem that jenkins is not a full user. Try this:

Create a user for Jenkins

It’s best to run Jenkins as it’s own user (it can then be limited in the permissions it has), and you’ll want to create a standard (full) user for it.

You can do this through System Preferences, the Server Manager or the command line.

For a local user:

# create an applications group
dseditgroup -o create -n . -u username -p -r ‘Applications’ applications
# get the id for that group
sudo dscl . -read /Groups/applications
# find a unique identifier to give the user
sudo dscl . -list /Users UniqueID
# create the jenkins user
sudo dscl . -create /Users/jenkins
sudo dscl . -create /Users/jenkins PrimaryGroupID 505
sudo dscl . -create /Users/jenkins UniqueID 1026
sudo dscl . -create /Users/jenkins UserShell /bin/bash
sudo dscl . -create /Users/jenkins RealName "Jenkins"
sudo dscl . -create /Users/jenkins NFSHomeDirectory /Users/jenkins
sudo dscl . -passwd /Users/jenkins
# create and set the owner of the home directory
sudo mkdir /Users/jenkins
sudo chown -R jenkins /Users/jenkins

I found this here: installing jenkins on OS X Yosemite

like image 134
S.Spieker Avatar answered Oct 25 '22 01:10

S.Spieker


In linux, e.g. ubuntu, you can add user jenkins to the root group:

sudo usermod -a -G root jenkins

Then restart jenkins:

sudo service jenkins restart

Be aware that, adding jenkins user to root group can make the user too powerful, use with caution

like image 27
Jonathan L Avatar answered Oct 25 '22 03:10

Jonathan L