jenkins build failure shell command permission denied

Multi tool use
jenkins build failure shell command permission denied
I am trying to run shell build command on mac but I get permission denied
for e.g. ls /Users/...
command.
permission denied
ls /Users/...
I see whoami
is jenkins
, which is different for my uesr login?
whoami
jenkins
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?
...
ls
chmod
3 Answers
3
Maybe you have a problem that jenkins
is not a full user. Try this:
jenkins
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
In my case, the folder was inside a NFS/Samba/Webdav share, which these scripts seem not able to handle.
I created a real folder in my fs and linked it to a subdir in the shared folder. That way, no permission denied errors occur anymore.
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
could only remove directories/folders with sudo mode, i.e. jenkins/workspace$ sudo rm -rf <foldername>
– HydTechie
May 31 at 15:50
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
The
...
in yourls
command is important for us to see, don't shorten it. Also "run chmod for jenkins user" means nothing to me.chmod
what file/directory? You changed file permissions, on what?– Kusalananda
Jun 19 '16 at 8:45