To switch users in one terminal session, you could use the su command :
This shows the current user.
$ su – seconduser [linux change user]
Switching to the second user.
This shows the second user as the current user.
Read: How to create a Sudo user on Ubuntu
You do not need to specify a username, If you want to login as root :
Current user is firstuser.
$ su – [change user linux]
Switching to root.
root is currently the active user.
Read: How to use sudo without having to enter a password in Ubuntu
In general, you can rely on sudo to start a new shell as the user you like.The -u option allows you to specify your desired username:
$ sudo -u seconduser zsh
If you do not have sudo access, there are some other alternative ways, like ssh username@localhost. The sudo command is rather simple to use as long as it is installed and you have the required permission to use it.
If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.