Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
share|improve this question
    
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
add comment

3 Answers

up vote 2 down vote accepted

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..

share|improve this answer
add comment

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

share|improve this answer
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.