0

I have 2 Linux systems: 32bit (eagle - 12.1) and 64bit (braswell - 42.2). In 64bit version I have /etc/sudoers.d/user, same as in 32bit also but in 32bit in /etc/sudoers file when I add includedir /etc/sudoers.d line in visudo editor I am getting syntax error which means can I take it as not supported? (question in my mind).

Syntax Error:

root@linux59:~> sudo visudo
sudo: >>> /etc/sudoers: syntax error near line 76 <<<
sudo: parse error in /etc/sudoers near line 76
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

this error is in 32bit

Error while executing serviname start in cmd:

sudo: >>> /etc/sudoers: syntax error near line 76 <<<
sudo: parse error in /etc/sudoers near line 76
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
sudo: >>> /etc/sudoers: syntax error near line 76 <<<
sudo: parse error in /etc/sudoers near line 76
sudo: no valid sudoers sources found, quitting

32 bit /etc/sudoers:

# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
#

Host alias specification

User alias specification

Cmnd alias specification

Defaults specification

Prevent environment variables from influencing programs in an

unexpected or harmful way (CVE-2005-2959, CVE-2005-4158, CVE-2006-0151)

Defaults always_set_home Defaults env_reset

Defaults env_keep = "LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS XDG_SESSION_COOKIE"

Comment out the preceding line and uncomment the following one if you need

to use special input methods. This may allow users to compromise the root

account if they are allowed to run commands without authentication.

#Defaults env_keep = "LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS XDG_SESSION_COOKIE XMODIFIERS GTK_IM_MODULE QT_IM_MODULE QT_IM_SWITCHER"

In the default (unconfigured) configuration, sudo asks for the root password.

This allows use of an ordinary user account for administration of a freshly

installed system. When configuring sudo, delete the two

following lines:

#Defaults targetpw # ask for the password of the target user i.e. root #ALL ALL=(ALL) ALL # WARNING! Only use this together with 'Defaults targetpw'!

Defaults visiblepw # needed to make 2root work again. The passwd is not printed on the screen, though.

Runas alias specification

User privilege specification

root ALL=(ALL) SETENV: ALL

m ALL=(ALL) SETENV:ALL deviceadm ALL = (ALL) SETENV: ALL

%nta ALL=SETENV: NOPASSWD: /Speicherkarte/Unicorn/setAdapter %nta ALL=SETENV: NOPASSWD: /Speicherkarte/Unicorn/setGateway %nta ALL=SETENV: NOPASSWD: /Speicherkarte/Unicorn/setPCName %nta ALL=SETENV: NOPASSWD: /Speicherkarte/Unicorn/test-usbstick %nta ALL=SETENV: NOPASSWD: /opt/mt/netconfig/netconfig.pl %nta ALL=SETENV: NOPASSWD: /bin/date %nta ALL=SETENV: NOPASSWD: /etc/init.d/nmb %nta ALL=SETENV: NOPASSWD: /bin/systemctl %nta ALL=SETENV: NOPASSWD: /usr/bin/systemctl %nta ALL=SETENV: NOPASSWD: /opt/RemoteService/run_remotegui.sh %nta ALL=SETENV: NOPASSWD: /sbin/halt %nta ALL=SETENV: NOPASSWD: /sbin/hwclock %nta ALL=SETENV: NOPASSWD: /sbin/poweroff %nta ALL=SETENV: NOPASSWD: /sbin/rcnetwork %nta ALL=SETENV: NOPASSWD: /sbin/reboot %nta ALL=SETENV: NOPASSWD: /usr/sbin/smartctl

device ALL=(deviceadm) NOPASSWD: /opt/mt/noop/startup/run_update device ALL=(deviceadm) NOPASSWD: /Speicherkarte/Unicorn/update.sh m ALL=SETENV: NOPASSWD: /usr/bin/systemctl m ALL=SETENV: NOPASSWD: /home/m/service/Services

Uncomment to allow members of group wheel to execute any command

%wheel ALL=(ALL) ALL

Uncomment to allow people in group wheel to run all commands

and set environment variables.

%wheel ALL=(ALL) SETENV: ALL

Same thing without a password

%wheel ALL=(ALL) NOPASSWD: SETENV: ALL

includedir /etc/sudoers.d

and in 64-bit:

## sudoers file.
##
## This file MUST be edited with the 'visudo' command as root.
## Failure to use 'visudo' may result in syntax or file permission errors
## that prevent sudo from running.
##
## See the sudoers man page for the details on how to write a sudoers file.
##

Host alias specification

IP addresses, network numbers or netgroups.

Host_Alias WEBSERVERS = www1, www2, www3

User alias specification

Groups of users. These may consist of user names, uids, Unix groups,

or netgroups.

User_Alias ADMINS = millert, dowdy, mikef

Cmnd alias specification

Groups of commands. Often used to group related commands together.

Cmnd_Alias PROCESSES = /usr/bin/nice, /bin/kill, /usr/bin/renice, \

/usr/bin/pkill, /usr/bin/top

Defaults specification

Prevent environment variables from influencing programs in an

unexpected or harmful way (CVE-2005-2959, CVE-2005-4158, CVE-2006-0151)

Defaults always_set_home

Path that will be used for every command run from sudo

#Defaults secure_path="/usr/sbin:/usr/bin:/sbin:/bin" #Defaults env_reset

Change env_reset to !env_reset in previous line to keep all environment variables

Following list will no longer be necessary after this change

Defaults env_keep = "LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS XDG_SESSION_COOKIE"

Comment out the preceding line and uncomment the following one if you need

to use special input methods. This may allow users to compromise the root

account if they are allowed to run commands without authentication.

#Defaults env_keep = "LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS XDG_SESSION_COOKIE XMODIFIERS GTK_IM_MODULE QT_IM_MODULE QT_IM_SWITCHER"

Do not insult users when they enter an incorrect password.

Defaults !insults

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!/sbin/reboot !log_output

In the default (unconfigured) configuration, sudo asks for the root password.

This allows use of an ordinary user account for administration of a freshly

installed system. When configuring sudo, delete the two

following lines:

Defaults targetpw # ask for the password of the target user i.e. root ALL ALL=(ALL) ALL # WARNING! Only use this together with 'Defaults targetpw'!

Runas alias specification

User privilege specification

root ALL=(ALL) SETENV: ALL

device ALL=(ALL) SETENV:ALL deviceadm ALL=(ALL) SETENV: ALL

%nta ALL=SETENV: NOPASSWD: /Speicherkarte/Unicorn/setAdapter %nta ALL=SETENV: NOPASSWD: /Speicherkarte/Unicorn/setGateway %nta ALL=SETENV: NOPASSWD: /Speicherkarte/Unicorn/setPCName %nta ALL=SETENV: NOPASSWD: /Speicherkarte/Unicorn/test-usbstick %nta ALL=SETENV: NOPASSWD: /opt/mt/netconfig/netconfig.pl %nta ALL=SETENV: NOPASSWD: /bin/date %nta ALL=SETENV: NOPASSWD: /etc/init.d/nmb %nta ALL=SETENV: NOPASSWD: /bin/systemctl %nta ALL=SETENV: NOPASSWD: /usr/bin/systemctl %nta ALL=SETENV: NOPASSWD: /opt/RemoteService/run_remotegui.sh %nta ALL=SETENV: NOPASSWD: /sbin/halt %nta ALL=SETENV: NOPASSWD: /sbin/hwclock %nta ALL=SETENV: NOPASSWD: /sbin/poweroff %nta ALL=SETENV: NOPASSWD: /sbin/rcnetwork %nta ALL=SETENV: NOPASSWD: /sbin/reboot %nta ALL=SETENV: NOPASSWD: /usr/sbin/smartctl

device ALL=(deviceadm) NOPASSWD: /opt/mt/noop/startup/run_update device ALL=(deviceadm) NOPASSWD: /Speicherkarte/Unicorn/update.sh device ALL=SETENV: NOPASSWD: /usr/bin/systemctl device ALL=SETENV: NOPASSWD: /home/m/service/Services

Uncomment to allow members of group wheel to execute any command

%wheel ALL=(ALL) ALL

Same thing without a password

%wheel ALL=(ALL) NOPASSWD: ALL

Read drop-in files from /etc/sudoers.d

(the '#' here does not indicate a comment)

#includedir /etc/sudoers.d %nta ALL=SETENV: NOPASSWD: /usr/bin/ping

How to make it work is it possible to use /etc/sudoers.d in 32bit version?

Adam
  • 1

1 Answers1

1

Preliminary note

I don't know AutoDesk EAGLE at all. I was not able to trace "eagle - 12.1" to see if it's very old, new or what. For this reason the answer is general.


Analysis

See the comment in the second sudoers file you posted:

the '#' here does not indicate a comment

#includedir is the uncommented directive, commented one would be ##includedir. Sole includedir is not recognized, hence the error. Very confusing, I know.

Another confusing directive is #include.

Recent enough sudo supports @includedir and @include, so we can make it far less confusing; but it still supports #includedir and #include for compatibility.


Solution

If you can still edit the sudoers file (e.g. you can log in directly as root), do so and change includedir to #includedir. This should fix the syntax. Verify if sudo works. Verify if files from the directory get included (sudo -l may be useful). According to the changelog sudo has supported #includedir since 2009-04-18. If #includedir is treated as a comment then apparently your sudo is too old and you cannot use #includedir as you intended. (I guess support for #include predates the support for #includedir; if #includedir does not work and you want to include one or few files, try one or few #include lines to include the files one by one, this may still work.)

If #includedir works, consider trying @includedir instead (supported since 2020-05-20): use visudo (sudo visudo if needed) and change #includedir to @includedir. If the tool complains, abort. If the tool does not complain and sudo still works – very well. The point of this step is making this line in sudoers less confusing. Now it's clear @includedir is not commented out, nobody will repeat your mistake.

If you cannot edit the sudoers file because you have locked yourself out from sudo and there is no other easy way, boot in recovery mode (I don't know AutoDesk EAGLE, so I cannot guide you in details) or boot a live distro and fix the file from there.