Two setuid programs, /usr/bin/bar and /usr/bin/baz, share a single configuration file foo. The configuration file's mode is 0640, for it holds sensitive information. The one program runs as bar:bar (that is, as user bar, group bar); the other as baz:baz. Changing users is not an option, and even changing groups would not be preferable.
I wish to hard link the single configuration file as /etc/bar/foo and /etc/baz/foo. However, this fails because the file must, as far as I know, belong either to root:bar or to root:baz.
Potential solution: Create a new group barbaz whose members are bar and baz. Let foo belong to root:barbaz.
That looks like a pretty heavy-handed solution to me. Is there no neater, simpler way to share the configuration file foo between the two programs?
For now, I am maintaining two, identical copies of the file. This works, but is obviously wrong. What would be right?
For information: I have little experience with Unix groups and none with setgid(2).
ssl-certgroup, which is pretty much yourbarbazgroup. The standard is to set all private keys to be owned by thessl-certgroup, and put the UIDs associated with the programs that need to access them into that group. – abligh 11 hours agossl-certwhose postinst script, at installation, creates the group of which you speak. I had been unaware ofssl-cert. Apache2 (installed on my host) recommendsssl-cert. The various Exim and Dovecot packages do not, but Postfix (not installed on my host) depends onssl-cert. Due to Apache, my host does have an ssl-cert group, but this group has no members yet. Thanks for the advice. – thb 10 hours ago