Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 currently have the following directory:

drwxrwsr-x   4 user1 Group1 4.0K Apr 18 18:29 foo

Under Group1 there are 20 users. I want to give user2 and user3 who belong to Group1 access to directory foo and restrict access to this directory to everyone else. Can someone please tell me how to achieve this?

share|improve this question
up vote 2 down vote accepted

Create a new group, add user2 and user3 to that group. Change the group ownership of the directory to the new group.

share|improve this answer
May be a dumb question but what if I don't have the ability to execute groupadd? My server complains: groupadd: unable to lock group file – Legend Apr 18 '12 at 22:45
Are you running it as root? If all else fails, strace it and see exactly what operation is failing. – David Schwartz Apr 18 '12 at 22:46
I don't have root privileges on the server so I guess that is the problem I am running into. Running strace tells me that the permission was denied while accessing /etc/.pwd.lock file. – Legend Apr 18 '12 at 22:48
Then you'll either have to ask the root user to create the group for you or use access control lists if your system supports them. If your need is legitimate, I'd suggest asking the system administrator how you should meet it. – David Schwartz Apr 18 '12 at 22:51
+1 Thank you. I just emailed my admin. Hopefully he will get back soon. Thanks for your help. – Legend Apr 18 '12 at 22:55

Your Answer


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.