sudo in c?
martin.klaffenboeck at gmx.at
Sat Jun 21 16:08:25 EDT 2003
How can I use sudo within my c programm?
I'd like to use it with popen, if possible. If there are other ways
that work, please tell me.
I found out:
When I use
ptr = popen ("sudo -S -v", "r+");
I simply can write the password with
fprintf(ptr, "%s\n", sudo_passwd);
but I cannot read the output from sudo via fgets() it seems that sudo
does not write to stdout, so how can I read the output from sudo?
Or does it have a c interface somehow?
If you've got an idea and need help,
or just need general encouragement,
write me a message. ;-)
More information about the sudo-users