If you are a root user and interested in switching to another user account, you can easily do it without requiring to know their password because you are a penguin.
However, if you are the user with sudo privileges and are interested in switching to another user account or root user, you are required to know your current password.
If you are a standard user without sudo privileges, you are still able to switch to another user account or to the account of the root user, but only if you know their password.
This is all done using the “
su” command in Linux.
|Description||Switching to Another User|
|Root or Sudo Privileges||Yes|
|Host System and Architecture||Ubuntu 22.10 (x64)|
|OS Compatibility||Ubuntu, Manjaro, Fedora, etc.|
Switch from Root to Another User Account
If you are a root user and interested in logging into another user’s account, use the following command with their username.
$ su [USERNAME]
Switch from Sudo User to Root User Account
If you are a user with sudo privileges, you can easily login to the root user account by knowing your current password, as shown.
$ sudo su
Switch from Sudo User to Normal User Account
If you want to peek into another user’s account, find out their username and know your current password, and specify both as shown.
$ sudo su jake
Switch from Normal User to Root User Account
If you are not a sudo user, you are still able to switch to the root user account only if you know the root account password as shown.
Switch from Normal User to Normal User Account
If you are interested in switching to another user account from your current account, which does not have sudo privileges, you must know their username and account password in order to login.
$ su jake
Exit from the Current Logged-in User Account
After switching to another user account to get back to your actual account, execute the
exit command in your current terminal session.
That’s all for now. Bye bye.