Switching user using sudo command in Linux shell

Sudo command

The sudo command is used to switch to another user.It will give the special
priviledges to the user.It provides the root access to the ordinary user.
This is the equivalent of “run as administrator” option in Windows.

The user can perform any operation such as update,delete,change permission,etc on others files.

Example for sudo

If you want to switch to another account after login to the linux server,you can just run the above sudo command. Once you give the password to login, you can perform any action as a sudo user.

sudo -u – > Switch to another user
user -> Target user name to login
-s ->Start a shell as user.

To change to Root account

If you use sudo -s command alone , it will start the shell as root.But still you need to give the password to login as a root user.