sh file permissions

20 views
Skip to first unread message

Ashish Yadav

unread,
May 8, 2015, 12:24:09 PM5/8/15
to jenkins...@googlegroups.com
I am trying to run a job can executes a .sh file and am getting permission denied. The file is owned by the jenkins user but doesn’t have execute permissions. If I update the file in the job workspace to have execute permissions, the file perms get overlaid every time the job the runs. How can Jenkins call and execute a .sh file in the workspace?

Eric Pyle

unread,
May 8, 2015, 12:29:23 PM5/8/15
to jenkins...@googlegroups.com
Hi Ashish,

Assuming your .sh file is kept in source control, you need to make the file executable and commit that change to your source control system. Or you could just add the command "chmod +x <filename>.sh" before running the script.

Regards,
Eric


On 5/8/2015 12:24 PM, Ashish Yadav wrote:
I am trying to run a job can executes a .sh file and am getting permission denied. The file is owned by the jenkins user but doesn’t have execute permissions. If I update the file in the job workspace to have execute permissions, the file perms get overlaid every time the job the runs. How can Jenkins call and execute a .sh file in the workspace?
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/D1724D53.D14A%25ashish.yadav%40firemon.com.
For more options, visit https://groups.google.com/d/optout.

John Mellor

unread,
May 8, 2015, 1:12:06 PM5/8/15
to jenkins...@googlegroups.com

Ø  . . . but doesn’t have execute permissions . . .

 

Assuming that the script is running on a unix or linux machine, you should be able to run it without execute permission by invoking it as “sh <script>” instead of directly.  If your version control is cvs, subversion or a couple of others, then this is kind of a well-known problem.  If it is something like git, then you should be able to correct the permissions permanently.

 

Alternatively, just add another step before executing it to fix the permissions.

--

Reply all
Reply to author
Forward
0 new messages