The su command is used to switch to another user identity. If "user" is ignored when su is used to switch identities, the system switches to the "root" identity by default and requires a password. When switching from the root user to another user, you do not need to enter the password. Otherwise, you need to enter the password of the corresponding user. If the-or-l or -- login parameter is added to a new user, the current Shell environment is switched to the new user's Shell environment, which is equivalent to logging on to the new user from the console. Experiment: use su and su to switch user identities. 1)
The su command is used to switch to another user identity.
If "user" is ignored when su is used to switch identities, the system switches to the "root" identity by default and requires a password. When switching from the root user to another user, you do not need to enter the password. Otherwise, you need to enter the password of the corresponding user.
If the-or-l or -- login parameter is added to a new user, the current Shell environment is switched to the new user's Shell environment, which is equivalent to logging on to the new user from the console.
Lab:
Use su and su to switch user identities.
1) view the current directory with pwd: The Directory of the new user is not displayed when su switches to the new user.
Su-switch to the new user and display the Directory of the new user.