I have a folder under the /etc directory. This folder and files contained in it has to be accessed by every user beloning to myGroup group. I correctly set permissions: every file in this directory gives me, after

ls -l

my file owner myGroup

this goes for every subfolder (I manually set this for each file/folder).

Anyway, if I type

cat /etc/myFolder/example.txt

It tells me that I don't have anough permissions. I think this is due to the fact that /etc folder belongs to the root. But I don't want to change group to the /etc folder too! And I need that folder to stay there!

How to solve this problem?

edit: output of

ls -ld /etc/myFolder/ /etc/myFolder/example.txt

gives me

drwxr-xr-x 2 root myGroup 4096 feb 26 12:10 /etc/myFolder/

-r-------- 1 root myGroup 1204 feb 26 12:10 /etc/myFolder/example.txt

  • Please add the output of ls -ld /etc/myFolder/ /etc/myFolder/example.txt to your question. – Florian Diesch Feb 26 '14 at 13:48

Try :

sudo chown owner:group /etc/myFolder/ -R 

change owner to your user and the group belong to it

sudo chmod 775 /etc/myFolder/ -R

This shold give owner and group rwx permissions.

Note : you can change the permission as it fits your needs .

  • Thanks you really helped me! Anyway I just needed r/w so my code is 664 (4 is just read for other users). If I do so I can't cd to that folder anymore, while with 774 I could...any ideas? – Phate Feb 26 '14 at 14:27
  • welcome man we are here to help each others , happy to help you and dont forget to mark it as an answer if it helped you ;) – nux Feb 26 '14 at 14:28
  • if you can solve me this last problem I'll mark yours as answer for sure :) – Phate Feb 26 '14 at 14:29
  • try to change the owner from root to your user , why u want root to own it – nux Feb 26 '14 at 14:29
  • i think your user is not in the group , and act as others – nux Feb 26 '14 at 14:31

The ownership is right. The problem is with the permissions. You have to give read, write, and or execute permissions to those subfolders.

I suggest you use:

chmod -R 640 /etc/myFolder

So your user will have read/write acces, and the users in your group will have read access.

  • great...after this command even cd /etc/myFolder gives me insufficient permissions...and my user is member of the group... – Phate Feb 26 '14 at 14:10
  • Maybe try 760, with your normal user, not root. – animaletdesequia Feb 26 '14 at 22:27

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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