Issue
I have Jenkins installed on CentOS 7. I have a pipeline that run a simple command
steps
{
sh label: '', script: 'ls -l /DATA00/tomcat/tomcat-orion/lib/annotations-api.jar'
}
Here's the output:
ls: cannot access /DATA00/tomcat/tomcat-orion/lib/annotations-api.jar: Permission denied
Here's the permission of the file and directories:
drwxr-xr--. 5 webadm01 webadm01 49 19:32 29 Th06 DATA00
drwxr-xr--. 3 webadm01 webadm01 26 18:29 22 Th06 tomcat
drwxrw-r--. 9 webadm01 webadm01 258 17:26 29 Th06 tomcat-orion
drwxr-xr--. 2 webadm01 webadm01 4096 10:28 23 Th06 lib
-rw-r--r--. 1 webadm01 webadm01 12373 05:19 4 Th06 annotations-api.jar
When I log in the server as webadm01, I can run the command ls -l /DATA00/tomcat/tomcat-orion/lib/annotations-api.jar
just fine.
What's wrong here?
UPDATE:
User Jenkins doesn't belong to the group webadm01
I tried chmod 775
to all the directories, and then Jenkins sucessfully ran the command. As I understand, read permission is enough to run ls against a file/directory. Isn't it correct?
Solution
You need x on a directory ... S/E explanation.
Read reads the directory listing (the index of a book), execute lets you operate on its contents (the chapters and contents). aka, look but don't touch!
Answered By - Ian W Answer Checked By - Timothy Miller (WPSolving Admin)