amazumda at stevens.edu
Fri Oct 12 17:42:29 EDT 2018
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?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cs631apue