Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|improve this question
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
up vote 1 down vote accepted

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.
share|improve this answer
    
thanks that was helpful :) – John M. Mar 24 '13 at 22:00

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

chown -R root /etc/myfolder
share|improve this answer
    
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

You must log in to answer this question.

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