--- Alexandr Malusek
Use:
#include
#include #include int main() { setuid(0); system("/usr/bin/touch /etc/resolv.conf"); return 0; }
Thanks a lot! That works. I didn't even know about
real vs. effective uid.
--- "Carlos E. R."
man system:
Do not use system() from a program with suid or sgid privileges (...)
I tried both system() and execl(), and the behavior seems to be the same. From what you wrote, however, I guess execl() would be safer, though. Unfortunately there's another issue where my naive approach doesn't work. Calling my binary 'touchresolv', I simply replaced the executable for the shortcut to kppp on my taskbar (kicker) with "touchresolv; kppp". Now if I click the shortcut icon, kicker freezes until I close kppp. After closing kppp, I get an error message "couldn't start /bin/sh". Any ideas? Maybe I should ask this question on the kde list... Klaus __________________________________ Do you Yahoo!? Free Pop-Up Blocker - Get it now http://companion.yahoo.com/