Results 1 to 5 of 5

Thread: how to add group permissions to a directory

  1. #1
    Join Date
    May 2010
    Beans
    16

    how to add group permissions to a directory

    I had thought it was this command: sudo chmod g+a -R directory path

    but it's not, apparently.

    any help would be appreciated

  2. #2
    Join Date
    Apr 2012
    Beans
    6,903

    Re: how to add group permissions to a directory

    what permissions do you want to add?

    Code:
    chmod g+r mydir # add read permission to members of primary group
    
    chmod g+w mydir # add write permission to members of primary group
    fyi 'a' is a synonym for 'all' e.g.

    Code:
    chmod a+w # add write permission for owner, group and others

  3. #3
    Join Date
    May 2010
    Beans
    16

    Re: how to add group permissions to a directory

    Quote Originally Posted by steeldriver View Post
    what permissions do you want to add?

    Code:
    chmod g+r mydir # add read permission to members of primary group
    
    chmod g+w mydir # add write permission to members of primary group
    fyi 'a' is a synonym for 'all' e.g.

    Code:
    chmod a+w # add write permission for owner, group and others
    777 would probably be best.

    so if I'm reading your above code right, the last one would work best for me?

  4. #4
    Join Date
    Apr 2012
    Beans
    6,903

    Re: how to add group permissions to a directory

    That depends... what are you trying to achieve exactly?

    There's nothing stopping you from using octal permissions directly with chmod i.e. chmod -R 777 dir however it's rarely a good idea imho to recursively make all files executable to everyone; if you want to make all files and directories in dir readable and writeable to everyone then you could use

    Code:
    chmod -R a=rwX dir
    [note that's a CAPITAL X] which will make all the directories rwx for owner (u) group (g) and others (o) but only give execute permission to regular files if they already have the execute bit set

    Hope this helps

  5. #5
    Join Date
    Aug 2011
    Location
    51.8° N 5.8° E
    Beans
    3,320
    Distro
    Xubuntu 16.04 Xenial Xerus

    Re: how to add group permissions to a directory

    So you know about octal notation for permissions? Then you can simply use
    Code:
    chmod 777 mydir
    But judging from your first post you want full rights for the group applied recursively. Assuming you only want execute permissions for directories and files where someone allready has execute permission, use
    Code:
    chmod -R g+rwX mydir
    You can also set the group permissions to be identical to the owner permissions:
    Code:
    chmod g=u mydir
    Else read the manual page for chmod:
    Code:
    man chmod

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •