3

I'm trying to remove symlink, although I have appropriate permission, the operation is denied (the user is called capistrno):

capistrno $ rm -f /var/www/app/current
rm: cannot remove `/var/www/app/current': Permission denied

the user should have all permissions to this file

lrwxrwxrwx 1 capistrano capistrano 42 17. mar 13.09 /var/www/app/current -> /var/www/app/releases/20130317120932/

capistrno $ file /var/www/app/current
/var/www/app/current: symbolic link to `/var/www/app/releases/20130317120932'

Any idea what's wrong?

EDIT:

folder /var/www/app

$ ls -laF /var/www/app/
total 16
drwxr-xr-x 4 www-data   www-data 4096 17. mar 14.15 ./
drwxrwxr-x 4 capistrano www-data 4096 17. mar 00.01 ../
drwxrwxr-x 6 capistrano www-data 4096 17. mar 14.15 releases/
drwxrwxr-x 7 capistrano www-data 4096 17. mar 00.39 shared/

user capistrano belongs to this groups:

$ groups
capistrano www-data rvm
Tombart
  • 2,143
  • 3
  • 27
  • 48
  • Please show the owner, group and permission of `/var/www/app`. It's the directory you need access to in order to add/remove files from it. – Celada Mar 17 '13 at 13:02
  • yeah, now I see it `chown -R capistrano /var/www/app` should fix it – Tombart Mar 17 '13 at 13:24

3 Answers3

4

Symlinks are always shown with 777 permissions and can be deleted by root, owner and owner group only.

Guardian
  • 199
  • 4
3

I would suggest you split your operation in 2 parts:

  • 'unlink' the symbolic link
  • 'rm' the unwanted directory

It is cleaner and less prone to errors. You will also get the exact errors, for each of those commands..

CloudWeavers
  • 2,531
  • 1
  • 15
  • 17
2

Unless you made a typo while sanitizing this post, You've assigned ownership and group to capistrano, while the user name is suposed to be capistrno.

capistrano =/= capistrno

eldorel
  • 113
  • 1
  • 7