3

I have typed sudo su in the Terminal, and then I typed whoami, and the Terminal said that I am the root user. So does that mean that sudo su makes me the root user or am I missing something?

user226756
  • 31
  • 1
  • 2

1 Answers1

1

Yes. You have the answer in man su:

SYNOPSIS
   su [options...] [-] [user [args...]]

DESCRIPTION
   su allows to run commands with substitute user and group ID.

   When called without arguments su defaults to running an interactive shell as root.

Note that the recommended method to do so is sudo su -, as it starts the root shell with a login shell environment:

   -, -l, --login
          Starts the shell as login shell with an environment similar to a real login:

             o      clears all environment variables except for TERM

             o      initializes the environment variables HOME, SHELL, USER, LOGNAME, PATH

             o      changes to the target user's home directory

             o      sets argv[0] of the shell to '-' in order to make the shell a login shell

or directly run sudo -i as explained in this answer.

dr_
  • 29,602