简体   繁体   中英

Permissions to delete generated files from another user in linux (gitlab-runner)

Im using gitlab-runner to deploy my php application to nginx web server. To deploy im using this steps: 1. delete all files in folder /var/www/site 2. move files from gitlab repository to /var/www/site

All these actions are performed only after pushing to repository new changes.

I have a problem. Files that copied to /var/www/site owned by gitlab-runner. After uploading file from post form, files owned by www-data (nginx user). After next push, gitlab cant deploy because it's failed on first step. user gitlab-runner hasn't right to delete www-data files.

I cant change nginx user to gitlab-runner for a reason, and i don't know how to change gitlab-runner to another user.

Anyone can help me?

You can use the command chown to change the owner of a file.

chmod uu:gg will set the owner of the file to uu and the group to gg.

You can change permissions of a file with chmod command.

chmod g+w will give write access to file to users of the group of

With this commands you should be able to set the group of the files to a group compatible with git-lab (check initial group of files with ls -l command)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM