Skip to content
Advertisement

Sudoers.d file is not picking up in SLES SP5

I was working with some Linux service file and in one scenario I need to invoke systemctl command as a different user say sar user. So I have wrote one sudoers file(/etc/sudoers.d) and added the following code

%sar ALL=NOPASSWD:/usr/sbin/dmidecode -t system, /usr/bin/chmod, /usr/bin/systemctl

Defaults:sar !requiretty

and I am invoking the command using sudo prefix

its working for the most of the Linux version but in SLES 12 SP5 its not picking sudoers file, so I am getting sudo: no tty present and no askpass program specified

Linux machine specs NAME="SLES" VERSION="12-SP5" VERSION_ID="12.5" PRETTY_NAME="SUSE Linux Enterprise Server 12 SP5" ID="sles" ANSI_COLOR="0;32" CPE_NAME="cpe:/o:suse:sles:12:sp5"

Advertisement

Answer

Try removing the “%” from the beginning of the sudoers file, In SLES distribution it not considered as a valid format

sar ALL=NOPASSWD:/usr/sbin/dmidecode -t system, /usr/bin/chmod, /usr/bin/systemctl

Defaults:sar !requiretty
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement