Linux permissions issue

I'm trying to use Jenkins to deploy to a custom workspace but am having permissions issues. The custom workspace folder is /var/www/workspace which is owned by www-data and in the www-data group as normal. I have added my jenkins user to the www-data group and the folder has writable permissions on user and group level. When I run the Jenkins build it fails because it doesn't have permission to clone into the folder. The only thing I can think of that may be stopping this from happening is the fact that the var folder is owned by root even though www and all folder below this are owned by www-data

Any advice appreciated.

linuxpermissionsjenkins

Answers

answered 5 years ago abhishek verma #1

Do one thing, go to /var/www/ and type the following command and paste output:

ll

answered 5 years ago Joni #2

Responding to your comment, to change the owner and group of /var/www/workspace and all files under it you can use:

chown -R jenkins:www-data /var/www/workspace

answered 5 years ago Richard Cleverley #3

In the end I changed the user that Jenkins is running as from Jenkins to www-data. Probably not the ideal way to do things but as this is on a non public facing server it suits my purpose. Now when a build has completed I get Jenkins to run a couple of chmod commands to make sure file permissions are correct and the files are already in the www-data group so all works nicely.

comments powered by Disqus