/etc/sudoers.d/sudoers_zabbix_smartctl: syntax error near line 6 <<<
denisgolius opened this issue · comments
How to fix this file if you got an error:
sudo -i
>>> /etc/sudoers.d/sudoers_zabbix_smartctl: syntax error near line 6 <<<
sudo: parse error in /etc/sudoers.d/sudoers_zabbix_smartctl near line 6
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
This link will help to you - https://sergeymukhin.com/blog/povrezhdennyy-etc-sudoers-oshibka-v-sintaksise
There is my hack to resolve issue wtih syntax error near line 6 <<<
Cmnd_Alias SMARTCTL = /usr/sbin/smartctl
Cmnd_Alias SMARTCTL_DISCOVERY = /etc/zabbix/scripts/smartctl-disks-discovery.pl
zabbix ALL= (ALL) NOPASSWD: SMARTCTL, SMARTCTL_DISCOVERY
Defaults!SMARTCTL !logfile, !syslog, !pam_session
Defaults!SMARTCTL_DISCOVERY !logfile, !syslog, !pam_session
Add colons after word Defaults and before !SMARTCTL for two last lines
#!/bin/bash
Cmnd_Alias SMARTCTL = /usr/sbin/smartctl
Cmnd_Alias SMARTCTL_DISCOVERY = /etc/zabbix/scripts/smartctl-disks-discovery.pl
zabbix ALL= (ALL) NOPASSWD: SMARTCTL, SMARTCTL_DISCOVERY
Defaults:!SMARTCTL !logfile, !syslog, !pam_session
Defaults:!SMARTCTL_DISCOVERY !logfile, !syslog, !pam_session
Add an empty line at the end of file.