Real UID, effective UID, and some systems even have a \"saved UID\". What\'s the purpose of all these, especially the last one?
The accepted answer is not correct regarding that real UD's can not be changed by anyone except root. From the man page for setuid: (I could not make a comment)
The setuid() function sets the real and effective user IDs and the saved set-user-ID of the current process to the specified value. The setuid() function is permitted if the effective user ID is that of the super user, or if the specified user ID is the same as the effective user ID. If not, but the specified user ID is the same as the real user ID, setuid() will set the effective user ID to the real user ID.