Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
A set-user-ID (or set-group-ID) program typically requires privileges only to perform certain operations. While the program (especially one assuming superuser privileges) is performing other work, it should disable these privileges. When privileges will never again be required, they should be dropped permanently. In other words, the program should always operate with the least privilege required to accomplish the tasks that it is currently performing. The saved set-user-ID facility was designed for this purpose (Section 9.4).
In a set-user-ID program, we can use the following sequence of seteuid() calls to temporarily drop and then reacquire privileges: