One, switch from user to root user
Whether you're logging in to Ubuntu in graphical mode or in command-line mode, we'll find that the default is user, but when we need to do something with root privileges (such as a system file), we often need to use sudo to authorize it, which is a hassle, and we can switch to the root user, Simply execute sudo su.
1 [email protected]:~$ sudo su2
Note: For security reasons, the default Ubuntu root user does not have a fixed password, its password is randomly generated and dynamically changed, it seems to change every 5 minutes, so with SU (switch user) is not possible, because we do not know the root password.
Second, from the root user to cut back to the user
To cut back from the root user, simply execute the command: SU User (User is the username of your own installation), or enter exit directly or ctrl+d the combo key to exit.
1 [email protected]:/home/hadoop# su hadoop2
Switching users of Linux commands