This is something of a ‘background’ answer.
Others have noted that what you are looking for is infeasible, if someone has physical access. There's another reason why you can't control the privileges of a unix user, though...
Unix doesn't have ‘privileges’.
The traditional unix security model is:
- Access to the filesystem, or filesystem-like things, is controlled by the user/group/other model.
- ...but processes with UID 0 are exempt from checking.
That is, it's not that root has ‘high privilege’, but permissions checks are simply skipped, wholesale, for processes with UID 0. There is nothing between ‘ordinary user’ and ‘free pass to do everything’ (‘Hello, I'm root, can I...?’ – ‘Yes!’).
One exception (others mentioned this) is systems which have a MAC component, such as SELinux, or the TrustedBSD framework used in macOS amongst others (yes, Macs have MACs!). Here, access controls, with ACLs, are built in to the kernel, and root/UID-0 processes are subject to those controls, just like any other. For the purposes of this answer, I'm taking those to be something of an add-on (and this is why I said ‘traditional’ above).
Another exception appears to be sudo
. But that's not a way of manipulating privileges, but simply a suid-root program (ie, a userland add-on) which will let certain users create a UID-0 process... which is therefore exempt from checking. This walks and quacks like a privilege system, but it isn't really one.
Depending on your tastes, this situation is elegantly minimalist, or how-can-they-have-got-away-with-it brainless (my vote is for the former).
Other well-known systems with real privilege systems are VMS, with an intricate set of privileges and permissions (of which the only one that really mattered was SETPRV, the privilege to give yourself privileges (I never managed to get anyone to give me that bit)), or Windows which, because of its designer, inherited important parts of the VMS conceptual architecture.
(To get back to your original question, the real answer, as others have said, is to take a backup or image of the box, and restore that if and when you take back the machine).