Http://www.uplook.cn/index-Index-show-view15192.html The default accounts for most Linux distributions are regular users, and changing system files or executing certain commands requires root, which requires switching from the current user to the root user. The commands for switching users in Linux are Su or Su-. The day before yesterday when I used the useradd command, I realized the essential difference between the two.
I first switched to root with the SU command, but when I ran Useradd, an error occurred: Bash:useradd:command not found. Google for a bit, because of this with the SU command to switch over the root user.
The most essential difference between the SU command and the Su-command is that the former simply switches the root identity, but the shell environment is still the shell of the normal user, and the user and the shell environment are switched to root. 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.
Linux is like this, sometimes the configuration file more or less a space, the service will not run. Details must pay attention to, so as to less detours!
(summary) The essential difference between Su and Su-commands under Linux