0

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/
  • 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? – nohillside 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

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/

You must log in to answer this question.

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