linux switch user code example
Example 1: change user linux
sudo su - username
Example 2: linux switch user
$ whoami
user1
$ su - user2
Password:
$ whoami
user2
$ exit
logout
sudo su - username
$ whoami
user1
$ su - user2
Password:
$ whoami
user2
$ exit
logout