Using the "su" command and switching from user to root

Expertise level: Medium

The su command:

su command is used to switch the current user to another user from SSH.

If you are in the shell under your "username", you can change it to another user (say root) using the su command.

This is especially used when direct root login is disabled.

 

Use this procedure to change shell user from "username" to root:

Login to ssh as "username".

Type this command from the shell to change to root user:

su -

If you need to change to a different user "username2", the command will take this form:

su - username2

You will be asked for password and enter the password for root/"username2" at the console.

Now, the shell user will be switched to root (or username2).

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk