8

I have a folder named docs, how do I add rwx permissions for group devs to docs?

I tried:

chmod -R g+rwx docs

but I don't know where to specify that it's the devs group I want to grant permissions for.

5

What you did is right but first you may have to change the group to "devs" with the chgrp or chown command. Note that in unixland a file only has one group.

1
  • 2
    A file/folder only has one group unless you have ACLs turned on.
    – Chris S
    Apr 29 '10 at 0:10
1

You're probably looking for chown or chgrp

1
  • 1
    chown [user]:[group] [file] or chgrp [group] [file]
    – Chris S
    Apr 29 '10 at 0:10
1

You can specify the group of the file using the chgrp command.

1

First thing to do is:

chown -R <user>:devs docs

then:

chmod -R 070 docs

That will give rwx to the group of docs and no permissions to the rest, if you want the owner to have the same permissions then do:

chmod -R 770 docs
1

You probably have umask set to 0022. Do:

umask 0002
chmod -R g+rwx
umask 0022

That should work

1
  • umask affects file creation. You don't need to change it in order to be able to chmod a file. Apr 29 '10 at 7:30

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.