The default account for most Linux distributions is ordinary users, and changing system files or executing certain commands requires root, which requires the switch from the current user to the root user, the command for switching users in Linux is Su or Su-, below the SU command and Su- Command the most essential difference for everyone to explain:
The former only switches the root identity, but the shell environment is still a normal user's shell, and the user and the shell environment to switch to root identity. The PATH environment variable error does not occur unless you switch the shell environment. After the SU switch to the root user, PWD, found that the working directory is still the normal user's working directory, and after the Su-command switch, the working directory becomes the working directory of root. Use the echo $PATH command to see how the Su and Su-future environment variables are different. And so on, to switch from the current user to another user, you should use the Su-command.
For example: Under ordinary user input:
$pwd
/home/test (current user directory)
$SU ****** (enter password)
#pwd (see the path again)
/home/test (or current user directory)
However, if you change to Su-the result is as follows:
$pwd
/home/test (current user directory)
$SU-
(Enter password)
#pwd (see the path again)
/root (switch to Super User directory)
Linux User Switching: su and Su-difference