Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I have a folder owned by root:admin. I would like to change permissions of all files inside, so I can edit them without sudo, but recursive chmod fails:

$ sudo chmod -R u+w some-folder/

does nothing. Any ideas how to fix it?

At the same time changing permission to a single file works seamlessly.

Story:

I installed a Python package from GitHub repository via pip, as an editable install. I am contributing some changes to it, but doing sudo for every edit and every git command is not convenient (I guess - neither safe).

EDIT:

$ sudo chmod -v -R u+w some-folder/

returns nothing.

Path is below:

/usr/local/lib/python2.7/site-packages/
share|improve this question
1  
You likely want to edit o other permissions and not u user (owner) permissions. Any symlinks in the folder? By default chmod -R does not follow them. –  laalto Nov 13 '13 at 11:27
    
@laalto No symlinks. I do want u permissions (for a file I changed it with u+w I can edit it without sudo). –  Piotr Migdal Nov 13 '13 at 11:34
    
Can you please run sudo chmod -v -R u+w some-folder/ and edit the result into the question? –  patrix Nov 13 '13 at 12:22
    
What are the permissions and owner of the files? e.g. ls -l on the files –  Mark Nov 13 '13 at 12:24
    
@patrix I did it before. And there is no output of any kind. –  Piotr Migdal Nov 13 '13 at 12:24

1 Answer 1

up vote 1 down vote accepted

The issue is that to be able to write to a file you need to be the owner for u permissions or be part of the group for g.

Note as a user you are not root so if owned by root the u permission does not matter. As you are using sudo I assume you are in the admin group (this is not necessarily the case but if anyone alters this I would expect they fully understand these permissions). These files are owned by admin so the permission that matters is the g one.

Thus the chomd you need is

sudo chmod -v -R g+w some-folder/

There are alternatives

  1. As this is where python is installed you should be using pip, easy_install and setuptools to do these updates which will require sudo. Another way is to use virtualenv and so install will be done to your own directories
  2. You can change the owner
    sudo chown -R user some-folder/
share|improve this answer

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.