I am developing in C++ on NetBeans 6.9 on Ubuntu 11.04. I am making a system() call which I would like to be called as user “peter” rather than as root. I understand that
setuid(0);
sets the user to root but how does one set the user to peter?
Thanks,
Peter.
You perhaps want to search the password file for the correct user id via, e.g.
getpwnam(). Something like: