Changes to filses inside /etc/sudoers.d reset after restarting

General support questions
Post Reply
FranekW
Posts: 36
Joined: 2017/05/11 21:19:21

Changes to filses inside /etc/sudoers.d reset after restarting

Post by FranekW » 2018/03/16 14:57:35

I have a difficult problem to understand and cannot find any solution on google as well. My system is CentOS 7

I am trying to add a user, let's say UserA to a sudo group. First, I tried "usermod -a -G wheel" without any effect, even though the group "wheel" in "/etc/sudoers" is not commented. I then found that there are files inside "/etc/sudoers.d/", etc. "local_sudoers". This file contains those lines:

Code: Select all

User_Alias LOCAL_ADMINS = user1,user2
LOCAL_ADMINS     ALL = ALL
When I edited this file using visudo: "visudo -f /etc/sudoers.d/local_sudoers", and added the account UserA to the group, finally the UserA was able to run sudo. However, the file gets reset to its previous version, which is the one without the UserA when i restart system. Consequently after restart UserA cannot Is there any place in CentOS that causes overwriting this file which I should edit?

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Changes to filses inside /etc/sudoers.d reset after restarting

Post by TrevorH » 2018/03/16 15:11:05

We don't ship the file /etc/sudoers.d/local_sudoers so whatever is changing it back is not anything that CentOS does. You can check if it comes from a package on your system by using rpm -qf /etc/sudoers.d/local_sudoers or yum provides '/etc/sudoers.d/*'

The standard CentOS 7 sudoers file comes with "%wheel ALL=(ALL) ALL" so anyone in group wheel should be able to sudo anything.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply