c - Linux; Change UID to root if you are not root -


i write simple program

when run program, if not root user, input root password, change uid root

if (getuid()) {     char *pass = getpass("");     //how change uid root ? } 

how change uid root when got root password?

there no way change non-root user root. that's whole point. programs login, sshd, or su work starting root, either because of ancestry or having suid bit on executable file, , restricting can until authenticate password or other method, changing appropriate uid (either root or user you're logging in as) , exec'ing program (usually, shell).


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -