sudo configuration file The default configuration file for sudo is /etc/sudoers. Generally, the Linux-specified editing tool visudo is used. The advantage of this tool is that it can perform error checking. When adding rules that do not conform to the syntax rules, an error message will be prompted when saving and exiting. After configuration, you can switch to the authorized common user and use sudo -l to check which commands are executable or prohibited. Each line in the /etc/sudoers file is a rule. The # sign in front of it is considered a comment and is not executed. If the rule is very long, it can be written in multiple columns and the \ sign can be used to continue the line. The rules in /etc/sudoers can be divided into two categories: one is authorization rules, and the other is alias definitions. Alias definitions are not required, but authorization rules are required. Enter the root user and open the sudoers file # # This file MUST be edited with the 'visudo' command as root. # # Please consider adding local content in /etc/sudoers.d/ instead of # directly modifying this file. # # See the man page for details on how to write a sudoers file. # Defaults env_reset Defaults mail_badpass Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" # Host alias specification # User alias specification # Cmnd alias specification # User privilege specification root ALL=(ALL:ALL) ALL # Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) ALL # See sudoers(5) for more information on "#include" directives: #includedir /etc/sudoers.d Example 1: To add sudo privileges to ordinary user lin, add the following line (user name ALL=(ALL) ALL) below the line "root ALL=(ALL)ALL" and save the file. Example 2: How to allow ordinary user lin to have the permission to restart the /etc/init.d/nagios script Example 3: Allow ordinary user lin to have all superuser privileges without having to enter a password The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Common front-end JavaScript method encapsulation
>>: Detailed explanation of MySQL slow log query
Think about it: Why should css be placed in the h...
Table of contents Configuration parsing Service C...
Preface The basic principle of MySQL master-slave...
Table of contents Optimizing sorting queries Avoi...
How to recursively select all child elements usin...
In the process of writing the project page, I enc...
Sometimes the theme of a project cannot satisfy e...
A few days ago, I exchanged some knowledge about ...
In the previous article, you have installed Docke...
The large-screen digital scrolling effect comes f...
Table of contents Preface Style Function Descript...
Preface Golang provides the database/sql package ...
Table of contents 1. Supplementary knowledge poin...
Table of contents 1. Customize plan tasks 2. Sync...
View installation and uninstallation # View rpm -...