Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

capistrano 3 deploy:clean old releases permission error

I am trying to deploy my Yii application using capistrino 3. Sever is EC2 ubuntu instance which by default comes with a user ubuntu. I have added ubuntu user to group www-data and trying to deploy using capistrino 3 but in old releases these runtime files creates some problem.

groups ubuntu
ubuntu : ubuntu adm dialout cdrom floppy sudo audio dip www-data video plugdev netdev

groups www-data
www-data : www-data

Apache server has created some files/folder as

drwxr-sr-x 2 www-data ubuntu 4096 Oct 12 15:23 CSS
drwxr-sr-x 2 www-data ubuntu 4096 Oct 12 15:17 HTML

When i tried to deploy the new version it says,

DEBUG[c9d0212b]     rm: cannot remove '/var/www/html/zl/releases/20141012145437/frontend/runtime/CSS/4.5.0,24166bfe16a0cc6bd18d813b83121ef2eaf16545,1.ser': Permission denied

What can be a workaround? I have added user ubuntu to group www-data, but new files have owner www-data and group ubuntu. i have no idea how it reversed.

like image 483
hemc4 Avatar asked Oct 13 '14 19:10

hemc4


1 Answers

The solution is to add your deploy user in a www-data group by following the bellow command:

sudo usermod -a -G www-data deployer_user_name

To check the user new group, follow the bellow command:

 groups deployer_user_name

After that capistrano clean up will be smooth ;)

like image 164
Naim Rajiv Avatar answered Nov 13 '22 08:11

Naim Rajiv