# How to suppress sudo logging?

## Jimini

Hey there,

for monitoring purposes, my /etc/sudoers contains the following lines:

```
zabbix ALL=(ALL) NOPASSWD: /sbin/mdadm --detail /dev/md1

zabbix ALL=(ALL) NOPASSWD: /sbin/mdadm --detail /dev/md2

zabbix ALL=(ALL) NOPASSWD: /sbin/mdadm --detail /dev/md3

zabbix ALL=(ALL) NOPASSWD: /sbin/mdadm --detail /dev/md5

zabbix ALL=(ALL) NOPASSWD: /sbin/mdadm --detail /dev/md6

zabbix ALL=(ALL) NOPASSWD: /sbin/mdadm --detail /dev/md7

zabbix ALL=(ALL) NOPASSWD: /sbin/mdadm --detail /dev/md8

zabbix ALL=(ALL) NOPASSWD: /usr/sbin/smartctl -a /dev/sda

zabbix ALL=(ALL) NOPASSWD: /usr/sbin/smartctl -a /dev/sdb

zabbix ALL=(ALL) NOPASSWD: /usr/sbin/smartctl -a /dev/sdc

zabbix ALL=(ALL) NOPASSWD: /usr/sbin/smartctl -a /dev/sdd

zabbix ALL=(ALL) NOPASSWD: /usr/sbin/smartctl -a /dev/sde

zabbix ALL=(ALL) NOPASSWD: /usr/sbin/smartctl -a /dev/sdf

zabbix ALL=(ALL) NOPASSWD: /usr/sbin/smartctl -a /dev/sdg

zabbix ALL=(ALL) NOPASSWD: /usr/sbin/smartctl -a /dev/sdh

zabbix ALL=(ALL) NOPASSWD: /usr/sbin/iptstate -1

zabbix ALL=(ALL) NOPASSWD: /usr/sbin/iptstate -1 -t
```

Since these commands are executed _really_ often, the messages of the successful use of sudo are filling my log files. How can I suppress logging just for these commands? The following settings do not work at all - everything keeps being logged:

```
## Uncomment to enable logging of a command's output, except for

## sudoreplay and reboot.  Use sudoreplay to play back logged sessions.

# Defaults log_output

# Defaults!/usr/bin/sudoreplay !log_output

# Defaults!/usr/local/bin/sudoreplay !log_output

# Defaults!/sbin/reboot !log_output

Defaults log_output

Defaults!/sbin/mdadm !log_output

Defaults!/usr/sbin/smartctl !log_output

Defaults!/usr/sbin/iptstate !log_output
```

Any help would be really appreciated.

Best regards,

Jimini

----------

## massimo

You might need to give the full command in the Defaults part too.

----------

## Jimini

Sorry, I forgot to mention that - if I add the full command including any parameters like "Defaults!/usr/bin/iptstate -1 !log_output", visudo complains about that.

MfG Jimini

----------

## massimo

Does it work if you edit and save the file using any other editor?

----------

## Jimini

I edited /etc/sudoers with nano to:

(47) Defaults!/usr/sbin/smartctl !log_output

(48) Defaults!/usr/sbin/iptstate -1 !log_output

As you can see, I added the parameter "-1" to line 48.

The following error was logged:

 *Quote:*   

> Sep 24 07:30:40 Atlas sudo:   zabbix : parse error in /etc/sudoers near line 47 ; TTY=unknown ; PWD=/ ;

 

Best regards,

Jimini

----------

