You are not logged in.

#1 2020-07-25 22:50:03

Flapper
Member
Registered: 2019-02-10
Posts: 46

[SOLVED] Lost my sudoers file

Having got the message "/etc/sudoers installed as /etc/sudoers.pacnew" when updating sudo, I (without thinking) renamed /etc/sudoers, and then tried to rename /etc/sudoers.pacnew, but I now get the error:

sudo: unable to stat /etc/sudoers: No such file or directory
sudo: no valid sudoers sources found, quitting
sudo: error initializing audit plugin sudoers_audit

Can I get round this by using su, or will this mess up ownership?

Last edited by Flapper (2020-07-25 23:10:04)

Offline

#2 2020-07-25 22:54:17

GaKu999
Member
From: US/Eastern
Registered: 2020-06-21
Posts: 696

Re: [SOLVED] Lost my sudoers file

If you can login as root, do so, restore your old sudoers file and run visudo.

The update is a change on the last line, the includes, that it now uses @ instead of #

If you can’t because the root user has no password you are locked out...
Do you have a pendrive with archiso in hand?


My reposSome snippets

Heisenberg might have been here.

Offline

#3 2020-07-25 22:54:57

GeorgeJP
Member
From: Czech Republic
Registered: 2020-01-28
Posts: 190

Re: [SOLVED] Lost my sudoers file

Log in as root. Reinstall sudo.

Offline

#4 2020-07-25 22:56:41

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,653
Website

Re: [SOLVED] Lost my sudoers file

Flapper wrote:

Can I get round this by using su

Of course. Why would it mess up ownership? In the future, use "pacdiff" (or equivalent) rather than manually renaming files.

https://wiki.archlinux.org/index.php/Pa … ve#pacdiff


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#5 2020-07-25 23:11:08

Flapper
Member
Registered: 2019-02-10
Posts: 46

Re: [SOLVED] Lost my sudoers file

Renamed it back to sudoers by using su, then edited with visudo. Marking as solved.

Offline

#6 2020-07-26 03:01:32

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] Lost my sudoers file

GeorgeJP wrote:

Log in as root. Reinstall sudo.

I'm mind-boggled that you think reinstalling sudo will solve the problem of incorrect configuration files that no longer have custom settings.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#7 2020-07-26 07:28:13

GeorgeJP
Member
From: Czech Republic
Registered: 2020-01-28
Posts: 190

Re: [SOLVED] Lost my sudoers file

eschwartz wrote:
GeorgeJP wrote:

Log in as root. Reinstall sudo.

I'm mind-boggled that you think reinstalling sudo will solve the problem of incorrect configuration files that no longer have custom settings.

Maybe I get it wrong.
Reinstalling sudo will solve missing file /etc/sudoers.
Custom settings should be saved in files in /etc/sudoers.d folder.

Offline

#8 2020-07-26 11:10:49

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,764

Re: [SOLVED] Lost my sudoers file

Unfortunately we don't live in a shouldland and the file conflict suggests that /etc/sudoers saw custom changes.

Online

Board footer

Powered by FluxBB