Penguin
Note: You are viewing an old revision of this page. View the current version.

SetUid? is when a program has the u+s permission bit set. This means that the program runs with the EffectiveUid? of the person that owns the file, not the person that runs the program. For instance a program owned by the user "root" and has the u+s (SetUid?) bit set, would run as root instead of a normal user when executed.

To run a progam completely as a new user, it needs to be suid to that user, and you need to execute

setregid(getegid(),getegid()); setreuid(geteuid(),getegid());

Many progams need this, as they will drop any euid permissions on startup.

To drop euid permissions

setregid(getgid(),getgid()); setregid(getuid(),getuid());