You are not logged in.

#1 2024-10-20 11:54:49

tethys
Member
Registered: 2019-08-13
Posts: 115

[Solved]How to change owner of /etc/sudoers back to root

When performing updates I changed by mistake the owner of the sudoers file from root to my username. How can I change it back to root?
If I try to perform any operation on sudoers file I get the following error messages:

sudo: /etc/sudoers is owned by uid 1000, should be 0
sudo: error initializing audit plugin sudoers_audit

EDIT: I solved the problem by booting from a rescue disk and changing permissions from there. I would still like to know if it is possible to change permissions without the use of a rescue disk.

Last edited by tethys (2024-10-20 12:39:24)

Offline

#2 2024-10-20 15:15:53

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 12,399
Website

Re: [Solved]How to change owner of /etc/sudoers back to root

If you have set a root password, then just su to root, you can fix the ownership of the sudoers file from there.

Alternatively use pkexec/doas/etc. (if you have them).


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

#3 2024-10-20 15:36:16

tethys
Member
Registered: 2019-08-13
Posts: 115

Re: [Solved]How to change owner of /etc/sudoers back to root

Thank you WorMzy, it did not strike me to use su, and I have indeed a root pasword.

Offline

Board footer

Powered by FluxBB