Difference between revisions of "Understanding sudo configuration syntax"
m |
m |
||
Line 1: | Line 1: | ||
<yambe:breadcrumb>Sudo configuration</yambe:breadcrumb> | <yambe:breadcrumb self="Understanding sudo configuration syntax">Sudo configuration|Sudo configuration</yambe:breadcrumb> | ||
=Sudo configuration syntax= | =Sudo configuration syntax= | ||
Line 20: | Line 20: | ||
<yambe:breadcrumb>Sudo configuration</yambe:breadcrumb> | <yambe:breadcrumb self="Understanding sudo configuration syntax">Sudo configuration|Sudo configuration</yambe:breadcrumb> |
Revision as of 06:05, 21 August 2018
<yambe:breadcrumb self="Understanding sudo configuration syntax">Sudo configuration|Sudo configuration</yambe:breadcrumb>
Sudo configuration syntax
Lines in sudo configuration use following format:
<username> or %<group> <machine> = [(<user>)] [NOPASSWD] :<command1> [, <command2> ...]
Note that group is indicated using %sign.
For example:
saurabh barjatiya = (root) NOPASSWD: /usr/sbin/wireshark, /usr/sbin/tcpdump
will allow user 'saurabh' to run '/usr/sbin/wireshark' and '/usr/sbin/tcpdump' commands on machine 'barjatiya' without supplying password as root user.
Please note that by default sudo requires tty. Hence running sudo commands from services such as MySQL, apache, nagios, etc. which do not have tty may not work. To change this default behavior comment 'Defaults Requiretty' in /etc/sudoers using visudo.
<yambe:breadcrumb self="Understanding sudo configuration syntax">Sudo configuration|Sudo configuration</yambe:breadcrumb>