sudo: /etc/sudoers is owned by uid 1001, should be 0 sudo: no valid sudoers sources found, quitting
Change the owner back to root: chown -R root /etc
sudo: /etc/sudoers is owned by uid 1001, should be 0 sudo: no valid sudoers sources found, quitting
Change the owner back to root: chown -R root /etc
sudo: /etc/sudoers is owned by uid 1000, should be 0
I ran into this problem also and with some digging, found a working solution.
The original solution is from this github issue for NixOS by EstalillaJ.
1. Open two ssh sessions to the target server.
2. In the first session, get the PID of bash by running:
echo $$
3. In the second session, start the authentication agent with:
pkttyagent --process (pid from step 2)
4. Back in the first session, run:
pkexec chown root:root /etc/sudoers /etc/sudoers.d -R
or
pkexec visudo
5. In the second session, you will get the password prompt. visudo will start
in the first session.
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us