3
h4xx3r
5y

LINUX MASTERS, I can't believe that linux didn't get rid off yet of the annoying user:group system.

Anyway, I have two pre-existing groups(postgres & www-data), now I need to enable both groups full access to an HD for data storing, currently the owner of /media/"user"/DATA is www-data but I need to enable the postgres group to operate in it.

I seached around and can't get around how to accomplish this, if it's even possible.

Help >_<

Comments
  • 1
    Seems like a job for ACLs.
  • 0
    @metamourge Access Control List, .-. thanks but something more handy?
  • 9
    Assuming you have adequate (root, or sudo) permissions to do so, simplest way is to:
    - create a new user group and add postgres and www-data users to that group
    - chgrp the DATA directory to the new group. Can be done recursively if you want everything in the drive to be accessible to www-data and postgres, otherwise need to chgrp everything you want shared
    - chmod the DATA directory to allow group R/W access. Again, this can be done recursively as well.

    Example commands:
    groupadd new_group
    usermod -aG new_group www-data
    usermod -aG new_group postgres
    chgrp new_group $path_to_directory
    chmod 664 $path_to_directory

    To run chgrp and chmod recursively, add -R after the command.

    Note: I'm ot sure what permissions you need, 664 is just an example. I'd suggest reading more on linux file permissions if you are new to them.

    Man pages for everything:
    https://linux.die.net/man/8/...
    https://linux.die.net/man/8/usermod
    https://linux.die.net/man/1/chgrp
    https://linux.die.net/man/1/chmod
  • 0
    @metamourge Another alien(setfacl) to keep in mind on linux .__.
  • 10
    Either ACLs or learn to do it the right, the POSIX way, the way group:user system was intended to be used, and quit fucking around and yelling a hammer is an idiotic thing because you cannot make a bolognese pasta with it.
  • 1
    @h4xx3r What would be "more handy" then ACLs where you can set permissions for an arbitrary amount of groups and users?
  • 2
    @sbiewald ACLs is a pain in the ass when it comes to administrating them.

    ACLs should be the very last resort or a _very_ temporary workaround. Always. They should not be the solution.

    Try managing thousands of servers where each directory is a potential landmine with ACLs!
  • 1
    User and group permissions are more than adequate for the task.
  • 0
    @netikras I build mostly user-facing apps so in my case I blame the file/directory properties windows that let you only modify permissions for only one user and one group -_-
  • 0
    @netikras I build mostly user-facing apps so in my case I blame the file/directory properties windows that let you only modify permissions for only one user and one group -_-
  • 0
    @sbiewald it worked out in the end, but I'm astonished that only superusers can accomplish such thing, the files/directories properties window is incomplete.
  • 1
  • 0
    @halfflat learning a matching expression language is out of question for file management ò.O
  • 0
    @netikras yep, but I like my Ubuntu mini server, unfortunately or fortunately <.<

    If you know what I mean.
  • 1
    @FrodoSwaggins Yeah, that is probably true. But considering the simplest solution needed, and not knowing more about the complexity and specific use case @h4xx3r is trying to solve, simple group/permission management is sufficient I feel.
Add Comment