Ubuntu switch to root user cannot find the environment variable PATH problem

Ubuntu switch to root user cannot find the environment variable PATH problem

The command usually used to switch ubuntu to the root user is:

su root

suIt is to switch user access rights, but the environment variable is not obtained;
therefore, the PATH environment variable cannot be found under the root user, and Java cannot be found.

There is also a way to switch users

su - root

su -It is a complete switch user, you can get environment variables, so you can find Java.

Guess you like

Origin blog.csdn.net/qq_27198345/article/details/109180564