Jenkins console : Permission Denied for /home/ec2-user/

0

Hello,

/var/lib/jenkins/workspace/dev-interview-cicd@tmp/durable-7a7f7a57/script.sh: line 1: cd: /home/ec2-user/: Permission denied

Role has been created and all the policies have been given to that role. And User has been created with all the polies specific to jenkins and ec2 that is used in jenkins pipeline. withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', credentialsId:'', accessKeyVariable:'AWS_ACCESS_KEY_ID', secretKeyVariable:'AWS_SECRET_ACCESS_KEY']]) { } Is also given in pipeline job, but still giving permission denied.

1 Answer
0

Hi,

By default Jenkins pipelines runs on Jenkins user who has only permission to access /var/lib/jenkins/ directory. Add/Update the permissions of directory /home/ec2-user/ to make the Jenkins user access it.

Use this command to give access to the directory: sudo chmod -R +rw /home/ec2-user/

Comment here if you need further help.

profile picture
answered 7 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions