HACK YOUR TERMINAL

Arian Fm
2 min readOct 2, 2024

--

“Resolving the ‘/etc/sudoers is owned by uid 1000, should be 0’ Error in Linux: Causes and Fixes”

One common issue that Linux users may encounter is an error related to the improper ownership of the /etc/sudoersfile, which plays a crucial role in managing user privileges. The error message "sudo: /etc/sudoers is owned by uid 1000, should be 0" indicates a misconfiguration where the file is not owned by the root user (UID 0), as it should be. This problem can prevent the use of sudo, compromising the ability to execute administrative commands and potentially leaving the system vulnerable or unmanageable. Understanding the cause of this issue and addressing it quickly is critical to maintaining proper system security and functionality.

for resolving this issue you have to do following steps:

you have to open two terminal shell from your server or pc

step 1 : in the first shell see the pid of the current terminal

arian@debian:$ echo $$

4439

as you can see the current pid is 4439 so i can have access to this process with this pid

step2 : on the other terminal write the following script

arian@debian:$ pkttyagent --process 4439

the shell is now listening the process 4439’s stdouts , so anything that you write on first shell with sudo the password should be inserted on second shell

step3 : write this on first terminal

pkexec chown root:root /etc/sudoers /etc/sudoers.d -R

after you write this on first shell automatically you can see that something appears on the second shell , so you have to write your pass on second shell and everything gonna be ok.

something about “pkttyagent”:

pkttyagent is a command-line tool that is part of the Polkit (formerly PolicyKit) framework, used in Linux to handle system-wide privileges. Specifically, pkttyagent is responsible for providing authentication prompts in a terminal environment, allowing users to authorize actions that require higher privileges (e.g., installing software or changing system settings) without using sudo.

When a user runs a command that requires administrative permissions, pkttyagent prompts for a password or authorization, making it possible to run privileged actions through a graphical or terminal session. It acts as an agent that listens for authentication requests and interacts with the user to collect and process credentials securely.

In essence, pkttyagent plays a vital role in bridging user interaction with privileged actions on a Linux system, especially in environments where Polkit is used for managing security policies.

--

--