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 個回答
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
已回答 8 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南