Simply use 'su 'to switch to the root identity,The read variable is set to non-login shell. Many original variables will not be changed.To completely switch to the new user's environment, you must use 'Su-username' or 'Su-l username' to use the login-shell method. Will be converted into the environment of new users together with the path/user/mail variables; therefore, the use of Su username may sometimes cause problems, but when some systems enter related commands, will replace some environment variables with your own. However, to ensure command correctness, use Su
-The usrname format is better. If you only want to execute the root command once, you can use 'Su-c "command string;
Example:
1) Use su Root
Root @ Ubuntu:/home/jack # env | grep 'jack'
Orbit_socketdir =/tmp/orbit-Jack
Username = Jack
Pwd =/home/Jack
2) use Su-Root
Root @ Ubuntu :~ # Env | grep Root
User = root
Mail =/var/mail/root
Pwd =/root
Home =/root
LOGNAME = root