I am setting up an automated backup job for some computers on my network. There is a server that will, daily, run an
rsync command to backup each of the other computers. I'd like the user that the
rsync job runs as to be able to read everyone's home directories (including sensitive files like encrypted secret SSH keys) but not be able to write anywhere on the system (except for
/tmp). I'd also like to prevent normal users from reading each other's home directories, especially the sensitive parts.
My first thought was to make a group comprising of only the backup user. Then I'd have the users
chgrp their files to the backup group. Not being members themselves, they wouldn't be able to read each other's files but the backup user could read everything they wanted backed up.
However, users cannot
chgrp to a group they are not a part of. I can't add them to the group since that would enable users to read each other's home directories.
I had considered giving the backup user a
NOPASSWD entry in the
sudoers file that allowed him to only run the exact
rsync command it needs as root, but that seems potentially disastrous if I don't set it up right (if there was a way to make a symlink to
/etc/sudoers and to get the
rsync command to use it as a destination, for example).