Monday, 27 November 2017

How to switch between users on one Linux terminal

Hi,


Below are two common ways to switch between users on one linux terminal:

1. Using su command:-

$ whoami
UserName1
$ su - UserName2
Password:
$ whoami
UserName2

To logout:
$ exit
logout

If you want to login as root, you obviously  can do it by the above method. All you have to do is not to specify any username.

$ whoami
UserName1
$ su
Password:
$ whoami
root

2. Using sudo command (provided it is installed)

No comments:

Post a Comment