9

I have a script that works with /etc/NetworkManager:

drwxr-xr-x   6 root root    4096 Apr  3  2017 NetworkManager/

I want to give the user programX write permission for this folder without changing the ownership.

Is that possible or would I have to change the ownership?

  • 1
    chmod o+w /etc/NetworkManager should be enough, but will defeat all security since this folder will be writable to all users. Adding this user to group root is not a good option too. What your script do? Maybe there is a way to make your script work in a more integrated way, that adding programX to group netdev or network could be a viable solution – user34720 Nov 3 '17 at 18:31
  • @nwildner it edits /etc/NetworkManager/NetworkManager.conf – Philip Kirkbride Nov 3 '17 at 18:32
12

This is what access control lists are for.

setfacl -m 'u:programX:rwx' /etc/NetworkManager
The user account programX now has read, write, and traverse access to the directory, but does not have ownership access.

Bonus way of doing this on FreeBSD with its NFS ACLs:

setfacl -m 'u:programX:rwxD::allow' /etc/NetworkManager

Further reading

2

You can use ACLs for this, first of make sure that the acl package is installed.

After that you can run

setfacl -m u:programX:rw NetworkManager/

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.