1

I have a folder located at /software which I want to make it read/write/exec to a group of users. The idea is that this folder will have common software installations, maintained by users from the same group. As an example this is what I was trying to do:

$ ls /
[...]
drwxr-xr-x 29 root root 555 Feb 18 18:31 software
[...]

If we go inside /software:

$ ls /software

drwxrwxr-x   2 user1 THEGROUP 26604 Feb 22 12:42 bin
drwxrwxr-x   2 user2 THEGROUP  4702 Feb 22 12:40 el6.3
drwxrwxr-x   2 user3 THEGROUP   236 May 26  2015 java-tools
drwxrwxr-x   3 user4 THEGROUP    30 Mar 26  2015 perl
drwxrwxr-x   2 user5 THEGROUP 11313 Jul 28  2015 perl-scripts
drwxrwxr-x   2 user6 THEGROUP  4893 Oct 29 12:30 python-scripts
drwxrwxr-x   2 user7 THEGROUP  1174 Sep 30 12:06 shell-scripts

For the sake of simplicity in the example do not care about things other permissions because I edited myself.

Notes:

  • user[1-7] should be able to read/write/exec in every folder inside /software
  • user[1-7] should be able to create new folders inside /software

How to achieve this? Thanks for your help!

0
  • Create a new group
  • chgrp the directory to this new group.
  • Set permissions for group writeable
  • Add all relevant users to the group.

All done.

The first step might depend on your distribution, but there is typically an `/etc/group. Edit it in your favourite text editor.

Then chgrp THEGROUP /software and chmod g+rwx /software

Adding users to a group can be done by editing /etc/passwd. This is best done carefully and there are nice tools for this (e.g. vipw)

Last items: New groups are only effective after a user logs in again. Secondly do you want items below /software also to have the same permissions. If you do look at the sticky bit for directories.

0

First set the owner and group for the directory by following command

chown -R user:group [directory]

Then give the group full access over directory

chown -R -g+xwr [directory]

Viola, done.

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.