We know that, from the shell, a convenient way of looking up who we are currently running as is to run the simple id(1) command; it displays the real UID and real GID (as well as all supplementary groups we belong to). As we have done earlier, let's try it out while logged in as the user seawolf:
$ iduid=1000(seawolf) gid=1000(seawolf) groups=1000(seawolf),4(adm),24(cdrom),27(sudo), [...]$
Consider again the sudo(8) utility; to run a program as another user, not as root, we can use the -u or --user= switch to sudo. For example, let's run the id(1) program as the user mail:
$ sudo -u mail id[sudo] password for seawolf: xxxuid=8(mail) gid=8(mail) groups=8(mail)$
As expected, once we provide the correct password, ...