Sometimes we only need to execute a command with the root permission to su to the root, isn't it inconvenient? In this case, sudo can be used instead.
The Default User Created by fedora is not in The sudo group. You need to edit the/etc/sudoers file to add the user. The file can only use the mongodo command. First, you need to switch to root.
Su-(Note that there is-, which is different from su. When the "su" command is used, the system only switches to root, but does not pass the root environment variable, or the currently used environment variable. Use the "su-" command to bring the environment variable together, just like root login)
Then
Mongodo
This is the same as vi usage. As some people may be unfamiliar with vi, let's take a brief look at the steps.
Move the cursor to the last line, press a, and enter the append mode.
Your_user_name ALL = (ALL)
Press Esc, enter w to save the file, and then exit q.
In this way, you can add yourself to the sudo group and use the sudo command.
If you find it troublesome to enter the password during sudo, replace the entered password with the following content:
Your_user_name ALL = (ALL) NOPASSWD: ALL
As for security issues, I think this is also acceptable for individual users.
Related Articles]
- Use the sudo command to assign management permissions to Ubuntu ADSL