Usage of sudo in Linux

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.