Scenario

CI/CD Pipeline Deployment Fails Due to File Permissions

The Problem

A DevOps team deploys an application through a CI/CD pipeline. During deployment, the pipeline attempts to execute a script named deploy.sh.

The deployment fails with an error similar to:

Permission denied

Although the script exists, it does not have execute permission for the user running the pipeline.

Investigation

The engineer checks the file permissions:

ls-l deploy.sh

Output:

-rw-r--r--

The owner has read and write permissions, but execute permission is missing.

Solution

Grant execute permission to the owner:

chmod u+x deploy.sh

If the CI/CD runner belongs to a shared group that also needs to execute the script:

chmod g+x deploy.sh

If ownership is incorrect, update it:

sudo chown cicd:devops deploy.sh