Give user access to folder without changing ownership?
This is what access control lists are for.
setfacl -m 'u:programX:rwx' /etc/NetworkManagerThe 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
- Operation not supported with setfacl?
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/