Despite the warnings in the first solution I have played a bit with symlink after I read this keyword.
One might do it like this:
Suppose both administrators adm1
and adm2
are in the same group admx
. Suppose /home/adm1
is the home directory of adm1
and it is properly configured. No work has to be done to provide adm2
with reasonable settings, since his directory will be replaced by a softlink to /home/adm1
:
sudo rm -rf /home/adm2 # remove the original home directory of adm2.
# Note: adm2 must exist before his home directory
# is replaced by a soft link, otherwise owner and
# group of the pointed to directory would change!
sudo chgrp admx /home # intermediate: now /home belongs root:admx
sudo chmod g+ws /home # intermediate: set w and SGID-bit to inherit group
sudo ln -s /home/adm1 /home/adm2 # create adm2's home directory as soft link
# due to SGID-bit, root:admx own the link
sudo chmod g-ws /home # remove rights granted in step 2 and 3
sudo chgrp root /home # back in original state
sudo chown -R adm1:admx /home/adm1 # make sure that adm2 gets access rights through group admx
sudo chmod -R g+s /home/adm1/ # establish group inheritance in favor of admx
sudo chmod -R g+w /home/adm1/.config/* # there might be programs like x-tile wanting to write there
The last two step are necessary because adm2
is not owner of /home/adm1
.
The advantage of this solution - albeit more complicated compared to the solution above - is that it avoids duplicating ./config
(not mentioned there) to the other administrator's home directory such that both enjoy the same settings. The second administrator gets all his power through the group admx
. The SGID bit set at the end makes sure that subsequently created directories below /home/adm1
also inherit group admx
.