Linux sudo is primarily used to assign partial permissions to specific users, while also restricting specific users from exceeding the scope of permission usage.
sudo configuration file:/etc/sudoers (Permission is 440, meaning only the root user can use it), this file is not recommended for VIM and other commands to edit, it is best to use the command Visudo directly.
Visudo Edit/etc/sudoers entry format:
Who which_hosts= (runas) [Tag:]command
The popular meaning of the previous entry is that a user (WHO) can execute commands (command) with the identity of another user (runas) through those (remote) hosts (which_hosts).
Who, Which_hosts, runas, and command support aliases (equivalent to the concept of a group), and aliases must all and only use a combination of uppercase English letters .
Who alias specification: User_alias Usersalias = ... (..... Can be user's user name,% group name, other user alias (that is, embedding)
Alias specification for which_hosts: Host_alias Hostalias = ..... (.... Can be host name, HostIP, Network/netmask)
Alias specification for Runas_alias: Exeusers = ..... (..... Can be user name,% group name, other runas alias)
Cmnd_alias alias specification: CMD = ..... (..... can be the absolute path to the command, the directory (all commands within this directory), and other pre-defined command aliases)
Tag mainly has nopasswd (do not enter the password), PASSWD (user input password, the default is to enter the password, enter the password for who's password .
sudo command execution logging in/var/log/secure
For specific use and precautions please refer to: Man sudoers
Example: (Platform redhat5.8-64 bit system)
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7E/FD/wKioL1cPOoHipkn4AAAG4aNPXyQ468.png "style=" float: none; "title=" 1.PNG "alt=" Wkiol1cpoohipkn4aaag4anpxyq468.png "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7E/FF/wKiom1cPOcqDmCcUAAAb2HlnqYA645.png "style=" float: none; "title=" 2.PNG "alt=" Wkiom1cpocqdmccuaaab2hlnqya645.png "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7E/FD/wKioL1cPOoLzgxVlAAAjZTKQsjI175.png "style=" float: none; "title=" 3.1.PNG "alt=" Wkiol1cpoolzgxvlaaajztkqsji175.png "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7E/FF/wKiom1cPOcriE1z6AAAHLTJVFLQ129.png "style=" float: none; "title=" 3.2.PNG "alt=" Wkiom1cpocrie1z6aaahltjvflq129.png "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/7E/FD/wKioL1cPOoKwj9HxAAAU-apCdmk886.png "style=" float: none; "title=" 3.3.PNG "alt=" Wkiol1cpookwj9hxaaau-apcdmk886.png "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7E/FD/wKioL1cPOoKiCoAKAAArs1NU2lA750.png "style=" float: none; "title=" 3.4.PNG "alt=" Wkiol1cpookicoakaaars1nu2la750.png "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7E/FD/wKioL1cPOoPD8F9LAAAWayuKFrg319.png "style=" float: none; "title=" 4.PNG "alt=" Wkiol1cpoopd8f9laaawayukfrg319.png "/>
Example 2: (add tag and alias)
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7F/00/wKiom1cPPhShVfPZAABsHoHaQbc034.png "title=" 7.PNG " alt= "Wkiom1cpphshvfpzaabshohaqbc034.png"/>
Linux sudo use