To actually change to a different user as if one would log in with that user, the
su command is used. With
su followed by a different username, it is possible to change the identity of the said user. Unlike
sudo, which requires the current user's password, here, the user to whom access is being requested is required, as shown in the following command:
packt@PacktPublishing:~$ su root Password:
Logging out of a shell or from a different user, the following
exit command is used. It takes no parameters. Alternatively, Ctrl + d can also be used to log out on nearly all shells.