How to use sudo and su to elevate yourself to root and then to another user

At times on a Linux server you want to switch to another user. One example could be one a shared server whereby you need to operate as the other user perhaps for reasons of permissions.

The command syntax to do that is:

sudo su - username

You will be elevated to super user mode, after which su will not ask for “username”‘s password because a super user is allowed to change into any other user without knowing their password.

Reference

Tags

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top