Home  >  Article  >  Operation and Maintenance  >  What is the difference between su, sudo and sudo -i?

What is the difference between su, sudo and sudo -i?

王林
王林forward
2020-09-30 17:34:394106browse

What is the difference between su, sudo and sudo -i?

The differences between the three are as follows:

(Recommended tutorial: linux tutorial)

sudo: Temporarily switch to super user mode To execute super user privileges, when prompted for a password, the password will be the password of the current user, not the password of the super account. The disadvantage is that every time you execute super user privileges, you must add sudo before the command. The advantage is that you do not need to re-enter the password when using sudo in the current terminal (valid only for the current terminal).

sudo -i: In order to frequently execute certain permissions that only the super user can execute without having to enter a password every time, you can use this command. When prompted for a password, the password will be the password for the current account. no time limit. After executing this command, the prompt changes to "#" instead of "$". When you want to return to a normal account, you can execute "exit" or "logout".

su: Switch to a certain user mode, the password when prompted to enter the password is the password of the account after switching, and the usage is "su account name". If no account is added later, the system defaults to the root account, and the password is also the password of the super account. no time limit. It should be noted that when using su to switch users, you need to bring -i so that you can switch with the environment.

The above is the detailed content of What is the difference between su, sudo and sudo -i?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete