2

I am running a script to deploy a website on a server. It gives me the following error:

DEBUG [4223cc8a] Command: /usr/bin/env chmod +x /tmp/mysite_staging/git-ssh.sh
DEBUG [4223cc8a] changing permissions of `/tmp/mysite_staging/git-ssh.sh'
DEBUG [4223cc8a] : Operation not permitted

It is complaining that the deploy user cannot change permission of that file. I already have set it so that the deploy user can read,write,execute the file, as the user is in the deploy group:

$ ls -l
total 4
-rwxrwx--x. 1 root deploy 93 Aug  5 09:22 git-ssh.sh

So how can I enable the deploy user to change the permission of this file? This is on CentOS. My temporary solution was to make the deploy user the owner of the file.

1
  • You an only change permissions of files you own, chown the file to the deploy user.
    – Drav Sloan
    Aug 5, 2015 at 13:38

2 Answers 2

4

Only the owner of a file, or the root user, can change the permissions of a file. You need either to change ownership of the file so it is owned by the deploy user, or run the script as root.

-2

Instead of chmod'ing Capistrano's uploaded shell scripts, it would be more secure to have Cap put them in a non-global tmp location. For example:

set :tmp_dir, "/home/deploy/tmp"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .