There are only 2 types of users in Linux: root and non-root. Rather than the root of the ordinary user's permissions are very low, basic processing their own home directory, many other places even the right to view, not to mention the installation of software.
In order to avoid switching back and forth Root,linux added the sudo command, namely: can temporarily switch root to execute some system commands, after use, return to the normal user, so as to avoid long-term use of root security risks,
It also effectively reduces the frequency of switching root.
1, the sudo command configuration Master profile:/etc/sudoers, however, the system documentation recommended practice is not to directly modify the /etc/sudoers file, but to write the changes in /etc/sudoers.d/ the directory file.
Any file in the /etc/sudoers.d/ directory that does not end with a ~ number and a file that does not contain a . number will be parsed into /etc/sudoers the content. Also note: If you use this method to modify Sudoers,
You need the /etc/sudoers last line of the file, plus the #includedir /etc/sudoers.d statement (which is already available by default).
Note that the instruction here #includedir is a whole, the preceding # number can not be lost, nor can # there be a space after the number. Also, use to edit sudoers as much as possible visudo , because there is an associated error-recognition mechanism.
Related documents:
# This'll cause sudoToReadand parse anyFiles in THE/ETC/SUDOERS.D
# directory thatDo not end in~or containA'. ' character.
# Note that there mustBES at least oneFile in the SUDOERS.D directory (this
# one woulddo), and all files in this directory should be mode 0440.
# Note Also, that because sudoers contents can vary widely, no attempt is
# made to add this directive to existing sudoers files on upgrade.
# Finally, please note that using the Visudo command is the Rec ommended to
# to update sudoers content, since it protects Against many failure modes.
2, the specific configuration command
Usage of sudo in Linux