Comment on What am I doing wrong with Linux/NAS permissions?
x1gma@lemmy.world 11 hours ago
Do not 777 everything. Never. Unix file permissions actually work, are pretty simple when you’ve worked with them, and most importantly are a huge part of your systems security as a whole. Running with broken permissions is a surefire way to get data exfiltrated or to provide an entry point for an attacker. Do not chmod everything, and do not run lax permissions.
Let’s say you have a service-A and a service-B running, each with their own user. A produces files into a shared folder, B consumes them. The proper Unix way of this is:
- create a group, and add both users to this group
- create the shared folder, change its group to one from above
- setup the other ACLs however you need
- set inheritance via chmod g+s
- point your services to that folder
The chmod g+s is the magic bit you’re missing. With this set, any file created will inherit the group ownership from its parent directory - so anything service-A creates will default to the permissions you’ve set up for the group on the folder, and since service-B is also in that group, files are readable.
This pattern applies to any number of services and in any deployment model.