How do I give a user to do whatever they please inside /var/www/myapp folder, which is owned by
root, considering that I don't want to change the owner?
I have setup TeamCity CI. It runs under user account
Now I created a job that copies build results to /var/www/myapp folder. The folder was initially created by root and is owned by root and I don't want to change that.
So, I wanted to give
teamcity user permissions to deploy everything into that folder and make the permissions inherited to all existing items, if any:
sudo setfacl -dR -m u:teamcity:rwx /var/www/myapp
getfacl /var/www/myapp getfacl: Removing leading '/' from absolute path names # file: var/www/app1 # owner: root # group: root user::rwx group::r-x other::r-x default:user::rwx default:user:teamcity:rwx default:group::r-x default:mask::rwx default:other::r-x
Looks fine, right?
But when I run cp task as a teamcity user, I get an error
cp: cannot create regular file '/var/www/myapp/appsettings.json': Permission denied
I tested also with
sudo runuser -l teamcity -c 'cd /opt/jetbrains/TeamCity/buildAgent/work/f5f9b0bd3b4556c2; cp -Rf appsettings.json /var/www/myapp/'
However, if I put
sudo in front of
cp then it seems to work fine. But I'd like to avoid adding teamcity to sudoers and spitting
sudos all over the place in my TeamCity scripts.