To switch between users sometimes sudo su newuser
is used.
What is meaning of sudo su
together?
Can anyone tell exactly how they both command together work?
sudo
su
is the command to "switch user" and the name behind it what you switch to, where nothing behind it makes you "root".
sudo -i
is preferred over sudo su
when switching to "root" since log files are then updated with the user login name and not "root".
When changing the user with su
you need to know the password of the user you are changing to.
Using sudo su - <username>
does not require the password of the user you are changing to, but only your own password for sudo
. With sudo
you effectively run su
as root
who is allowed to change the user without knowing the password of the user.