Quick Answer: How to Change User in Linux?
Contents

The su Command.

To change to a different user and create a session as if the other user had logged in from a command prompt, type “su -” followed by a space and the target user’s username.

Type the target user’s password when prompted.

What command is used to switching between users in Unix?

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.

How do I change user to Sudo in Linux?

4 Answers

  • Run sudo <command> and type in your login password, if prompted, to run only that instance of the command as root. Next time you run another or the same command without the sudo prefix, you will not have root access.
  • Run sudo -i .
  • Use the su (substitute user) command to get a root shell.
  • Run sudo -s .
James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest