sudo
Linux

How to resolve sudo error : no valid sudoers sources found

sudo ( Super User DO ) is a program on Linux system that enables users to run programs with the security privilege o the superuser root.

The theory behind using sudo is that it encourages users to think more about what they are doing before running a command.

In this article we will see how to solve the error message « no valid sudoers sources found, quitting » that we might encounter when using our « substitute user do ».

sudo
sudo

In the example below, I try to switch to the root account by running the su command with sudo, but this what I got :

[admin@sysreseau ~]$ sudo su
sudo: /etc/sudoers is mode 0640, should be 0440
sudo: no valid sudoers sources found, quitting

As you can see, the error message indicates that the file sudoers has the permissions 0640, while it should not be the case. the correct permissions are 0440.

Let’s see if it’s true :

[admin@sysreseau ~]$ ls -lh /etc/sudoers
-r--r----- 1 root root 3,4K janv. 17 09:46 /etc/sudoers

As you can see, the file does have the permissions 0640.

So we have to change this permission with the chmod command using the root account:

[root@sysreseau]# chmod 0440 /etc/sudoers

Then check if the permissions in the sudoers file are correct:

[root@sysreseau]# ls -lh /etc/sudoers
-r--r----- 1 root root 3,4K janv. 17 09:46 /etc/sudoers

Now we test the previous command :

[admin@sysreseau ~]$ sudo su
[sudo] password for admin:
[root@ipbx admin]#

And that’s it, now our sudo command is working.

To read this article in French, click here.

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *