You need to backup the modified files on /etc
. Whether they are in your home or not is orthogonal.
Your backup strategy for etc files could involve having a copy (or original) of those inside your home and getting them included in your (hopefully automated) $HOME backup, as you seem to have planned. But you could as well setup you backup program to also backup /etc as a separate location. You could list the modified files and hold a copy inside your home (while not changing the original to a symlink). You could hold a copy of all files in etc (such as a tar), since they will be small anyway. Another relatively common approach is to have a git repository storing the contents of /etc
.
Other people have already mentioned as potential shortcomings:
- Some specially security conscious programs refusing to follow symlinks
- The package manager failing to respect them. This should not happen as if it's modified, a well-behaved package manager should leave them alone, but I se how that might be a concern. I think it would be more likely that it could end up changed back from a symlink to a regular file under some circumstances where the package considers it is empowered to upgrade them.
/home
being on a separate partition, or even on NFS
I would like to point out another issue, which is that other users are not supposed to access your home. Thus /home/php_nub_qq
should only be readable by php_nub_qq itself, and that includes /home/php_nub_qq/snatched
.
You may be the only human user of your system, but even in that case there will (probably) be services running under other accounts!
Let's suppose you snatched /etc/resolv.conf
(replacing it with a symlink to /home/php_nub_qq/snatched/resolv.conf
) because you configured it with your preferred nameservers. Everything will probably work for php_nub_qq, and also for root. But you will find that freshclam
(the updater of the ClamAV database) is unable to fresh new packages, as it runs under a separate account and won't be able to read resolv.conf. Even the package manager may be (trying to) dropping privileges to a limited user for download and facing issues.
You could grant everyone read access to /home/php_nub_qq
but (1) it kinda misses the point, as other accounts should not need access there, your snatched approach had artificially added it, and (2) there may still be errors due to AppArmor, snap, etc. blocking access to /home
in their profiles (/etc
would be allowed, but your changes deviated from the defaults enough that some programs might no longer work out of the box).
You could make it work, eventually, with enough tweaks, but it's not worth the effort. It is much easier to use a slightly different approach, from having your snatched folder hold copies (a cron can ensure it is kept up to date), which would be the most similar to your original idea, to the others mentioned.
/etc
holds configuration global to the machine, and it is no error that it is a separate directory, while per user configuration goes to ~/.config
(plus still too many dotfiles for programs not following the XDG Base Directory Specification). Do note that, when the target is a user program, in many cases it is possible to override a global /etc
configuration inside the $HOME of the local user, even if not always properly documented (e.g. you can use ~/.config/git/config
instead of /etc/gitconfig
)
Do remember that in addition to your home and /etc
there are also other pieces of data stored elsewhere you will probably need to backup, such as the list of installed packages, the user crontab or even the mail spool.
Finally, let me congratulate you for preparing for a scenario where you may need to configure a new system. Those coming here from HNQ, how many of you would be able to quickly go back from your backups (you do have recent backups, right?) to a working system configured as you like, if the hard disk of your primary workstation crashed tomorrow?
etckeeper
. I think the "original" version is still maintained by Joey Hess here, and there are some others on GitHub that may be OK also./etc
are already symlinks./etc
are hardware-specific these days (xorg.conf
used to be the most prominent case 10+ years ago, it is not anymore). There's typically nothing stopping you from just copying/cloning everything to a new machine and running with that. My current home desktop was originally installed on a dual-socket Pentium III and has gone through several generations of underlying HW without a single OS reinstall. Similarly, switching work laptops always meant I just cloned the entire drive, no reinstallation or backup/restore needed.