Sudo loads the user variable and jumps to the target user home directory.
Sudo -s, do not load user variables, do not jump directory;
Sudo: temporarily switch to superuser mode to execute the superuser rights. When prompted for a password, the password is the password of the current user, not the password of the superuser. However, there is a time limit, Ubuntu defaults to 15 minutes at a time.
Su: when you enter the user mode, the password is the password of the new user, and the usage is su account name. If no account is added, the system uses the root account by default, and the password is also the password of the super account. There is no time limit. Sudo -i: This command is used to frequently execute certain permissions that can only be executed by the superuser without entering the password every time. The password is the password of the current account. There is no time limit. After this command is executed, the prompt changes to “#” instead of “$”. You can perform “exit” or “logout” when you want to return a regular account. The user requesting this command must be in sudoers
- Sudo -i Run the sudo command directly with the -i parameter. The user who runs the command must be in sudoers
- Sudo su Run the sudo command to lift the su command, and run the su command. The user requesting this command must be in sudoers
- Sudo -i Running result PWD=/root
- PWD=/home/ User name (home directory of the current user)