0

I wanted to give full permissions to some user in a folder.

I used for example

chown -R myuser /etc/myfolder

so , by doing ls -l on /etc/myfolder we can clearly see the owners of the file as: myuser root

The question is how can i remove myuser from being the owner of that folder? I used man chown and i searched on the web, but i cant find something useful . :S

Thanks!

  • 1
    I'm sorry, I don't quite understand the question. You did a chown -R myuser on the folder and now you're asking how to remove it again as the owner? Who should own the folder? A file or folder can only have one owner. – slhck Mar 24 '13 at 21:51
  • @slhck no, when i am doing ls -l theres myuser and root . I only want root – John M. Mar 24 '13 at 21:56
1

In traditional Unix permissions, a file or folder can only be owned by one user. When you do chown -R myuser, you set myuser as the owner of that particular file.

When doing an ls -l, the two names you see are the owner and the group the file belongs to, e.g. myuser being the owner and root being the group. Please read Unix Permissions for a little more info.

If you want the folder to be owned by root again, just do a chown -R root on it.

If you want a user to have full permissions on a folder, here are some possibilities you have:

  • Let the user own the folder with chown -R myuser, and make sure the folder has read, write and execute access for that particular user, e.g. with chmod u+rwx.
  • Add the user to a group that has read, write and execute access on the folder, e.g. useradd -G root myuser, where root is the name of the group, and chmod g+rwx. You also need to change the group of the folder with chgrp -R root for this to work.
0

AFAICT -R means recursive, not remove. Have you tried then:

chown -R root /etc/myfolder
  • i got the same answer already , but thanks :) Yes i know that -R stands for recursive , so it can affect all subfolders, not only the first one. – John M. Mar 24 '13 at 22:04
  • seconds late... sorry, it sounded from your post that that might have been a source of confusion. – Kev Mar 25 '13 at 12:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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