[cs631apue] setuid
Aubhik Mazumdar
amazumda at stevens.edu
Fri Oct 12 17:42:29 EDT 2018
Hello,
Initially I was facing segfaults while printing the username and group name
retrieved using getpwuid and getgruid. This was because the /etc/passwd and
shadow files cannot be accessed if you are not root.
To overcome this, I started using the setuid program to set the effective
userId to 0 (super user) and reverting back to the original uid after
reading the file.
Has anybody found a better way of getting the username and the groupname
without using setuid?
Thanks,
Aubhik Mazumdar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.stevens.edu/pipermail/cs631apue/attachments/20181012/c925562e/attachment.html>
More information about the cs631apue
mailing list