How to switch users in Linux shell

I want to switch to another user's account in Linux shell without logging out. How do I do this? Do I need root privileges to do so?

You can easily switch between users in Linux and you don't have to be root to do this. You can switch to another account by using the su command. To do this, you need to logged in first.

To switch to another user account in Linux using the su mode do the following:

  1. Once logged in type su followed by the user name you want to switch to, e.g. su john
  2. Type john's password and you're in
  3. Type exit to get out and return to your previous user. Type exit again and you'll log out

Post new comment

The content of this field is kept private and will not be shown publicly.