Gbru
Gbru

Reputation: 1087

Jenkins unable to execute .sh script on ubuntu permission denied?

Currently attempting to execute a shell script via Jenkins using a pipeline job but receiving the following error:

/var/lib/jenkins/workspace/Warehouse_Tests/src/test/java/runners/sql.sh: Permission denied

I have configured:

visudo -f /etc/sudoers 

to contain:

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL
jenkins ALL= NOPASSWD: ALL

Any ideas?

Upvotes: 0

Views: 3172

Answers (2)

mahendra rathod
mahendra rathod

Reputation: 1638

change the permission of files to jenkins:jenkins & 755 .

in the build only you can mentioned it .

also try to run with sudo

sudo sh /var/lib/jenkins/workspace/Warehouse_Tests/src/test/java/runners/sql.sh

suggestion - use Jenkins environment variable rather giving an actual path of your script.

Upvotes: 0

Gbru
Gbru

Reputation: 1087

Resolved by executing: sh chmod +x against the .sh script prior to triggering the scripts.

Upvotes: 1

Related Questions