Linux su sudo instruction

1. su command - switch user
1.1. Switch to root user (password required)
su - root

1.2. Switch to another user, such as jackma (no password required)
su - jackma

2. sudo command - add root permissions to ordinary users
2.1. Usage
Switch to the root user and execute the visudo command, which will automatically enter the vim compiler.

su - root

enter password

visudo

Add the following command to the last line

Add permissions for ordinary users, then:wq to save

Switch to normal user

are - jackma

Create a directory in the root directory with insufficient permissions

Use sudo command

Created successfully

2.2. Summary
You can give a common command with root privileges, the syntax is:

sudo other commands 

You need to execute the visudo command as the root user, and add configurations to allow ordinary users to have sudo command execution permissions. 

Guess you like

Origin blog.csdn.net/st75033562/article/details/133161621