0

Currently I already have a user deploy which has a script to run the deployment. I would like to create another user for example developers, to have an access on deploy's script file. How can I achieve this?

This is what I already tried: 1) Add another user: sudo adduser developers 2) Add both user to this group

$sudo usermod -a -G sharedfolders deploy
$sudo usermod -a -G sharedfolders developers

3) Give user developers an access in the deploy dirs

chown -R deploy:sharedfolders /home/deploy/source
1

There are many ways to handle file sharing permissions in Linux/unix:

  • Add the developer user to the deploy group, and set the script's permissions to allow read and execute for the group. e.g. chmod 750 myscript.sh
  • you may find in helpful to use linux "ACL" or access control lists, for instance instead of a developer user, you have a developer group, with many members. You can add an ACL to a sort of bin directory owned by deploy that automatically gives new files the read and execute permissions to the developer group
  • the benefit of "ACLs", is that directories and files can "belong" to more than one user or group, and inheritance properties can be added to directories, so new files "inherit" the applicable ACL permissions of the parent dir

In some cases, you may shy away from ACLs, because they're a special filesystem feature that may not be available on the FS you're using, or may be missed during a backup.

In the first case you're out of luck. You have to make a group specifically for the purpose of running these scripts, add your developers to it, and remember to chown and chmod the relevant scripts upon creation. (all parent dirs must be readable AND executable by the relevant users)

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.