#include
#include
#include
#include
int main(void) {
uid_t uid;
gid_t gid;
struct passwd *pw;
uid = getuid();
gid = getgid();
printf("I am user: %s\n", getlogin());
printf(" uid: %d\n", uid);
printf(" gid: %d\n", gid);
printf("\n");
pw = getpwuid(uid);
printf("Password entry for user %s:\n", pw->pw_name);
printf(" name : %s\n", pw->pw_name);
printf(" uid : %d\n", pw->pw_uid);
printf(" gid : %d\n", pw->pw_gid);
printf(" home : %s\n", pw->pw_dir);
printf(" shell: %s\n", pw->pw_shell);
printf("\n");
printf("Password entry for root:\n");
pw = getpwnam("root");
printf(" name : %s\n", pw->pw_name);
printf(" uid : %d\n", pw->pw_uid);
printf(" gid : %d\n", pw->pw_gid);
printf(" home : %s\n", pw->pw_dir);
printf(" shell: %s\n", pw->pw_shell);
return 0;
}