#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
#include <grp.h>
int main()
{
struct passwd *pwd = getpwuid(getuid());
struct group *grp = getgrgid(getgid());
printf("name: %s group: %sn", pwd->pw_name, grp->gr_name);
return 0;
}
标签: 编程