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?
Asked
Active
Viewed 9,142 times
3

Gilles 'SO- stop being evil'
- 829,060

user226756
- 31
- 1
- 2
-
2Yes. See also http://unix.stackexchange.com/questions/218169/is-there-ever-a-good-reason-to-run-sudo-su – Kusalananda Apr 13 '17 at 09:58
1 Answers
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.