Is is possible to change root's password using setuid?What I tried is writing a simple program which calls system(passwd root) owned by root and its setuid bit is set but it didn't work.The output is: You may not view or modify password information for root.
Changing root's passwords using setuid
password;root;setuid
In your program, you probably overlooked making the real and effective uid set to the same value.  Gids also should match root's gid. Something like this:setuid(geteuid());setgid(getegid());See for example sue (a simple setuid/setgid wrapper).