sudo is easy to use

 

-- Execute commands/scripts as root
sudo sh shell command or script

 

-- No need for root password, switch to root user.
sudo su root


-- No root password is required, switch to the root user. The difference from the above command is that the environment variable is also switched to the environment variable of the target user .
sudo su - root

 

Example 1,

 
 
Example 2,

 

 


Extended instructions:
1. When the user executes sudo, the Linux system will look for the /etc/sudoers file , and this is active to determine whether the user has the permission to execute the sudo command
2. If the user has the permission to execute the sudo command, let the user enter Confirm with your own password, which is much stronger than using the root password. Like it
. 3. If the password is entered correctly, start executing the shell command followed by sudo
. password.

 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326927531&siteId=291194637