0

I am having a problem on that whatever the contents of /etc/sudoers file I cannot elevate to sudo with anything, even with a password (wrong password - sorry, try again) though the password is correct.

Below are the contents from /etc/sudoers, which should be correct, unless in combination with other settings are broken. So, it must be something else.

FYI, I installed Puppet on my machine which in the beggining was controlling sudoers to my knowledge, but then I removed monitoring.

My normal privileges user is part of the adm group.

Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"

root ALL=(ALL:ALL) ALL

%adm ALL=(ALL) ALL %sudo ALL=(ALL:ALL) ALL

#includedir /etc/sudoers.d

Also, below is the output of /etc/sudoers.d folder and the contents of each file:

root@ns1:/home/vag# ls -la /etc/sudoers.d/
total 28
dr-xr-x---   2 root root  4096 Sep 22 23:46 .
drwxr-xr-x 151 root root 12288 Sep 23 19:19 ..
-r--r-----   1 root root    80 Sep 22 23:46 10_admins
-r--r-----   1 root root    90 Jun  4 20:06 60_mike
-r--r-----   1 root root    91 Jul 10 15:00 99-snapd.conf
root@ns1:/home/vag# cat /etc/sudoers.d/99-snapd.conf
 ##Allow snap-provided applications to work with sudo

Defaults secure_path += /snap/bin root@ns1:/home/vag# cat /etc/sudoers.d/60_mike

This file is managed by Puppet; changes may be overwritten

mike ALL=(ALL) NOPASSWD: ALL root@ns1:/home/vag# cat /etc/sudoers.d/10_admins

This file is managed by Puppet; changes may be overwritten

%adm ALL=(ALL) ALL

Can you help me to be able to use sudo again without having to "su root" every time?

Regards, Evang

vag
  • 41
  • Did you remove the app Puppet or just stop it? – Nate Sep 23 '20 at 16:17
  • Hi Nathaniel. I removed the app from Puppet, e.g. this not monitored now. In short, nothing overides the file as it stands. – vag Sep 23 '20 at 16:44
  • I mean did you remove puppet? – Nate Sep 23 '20 at 17:12
  • 1
    No, I haven't. But the file doesn't seem to be managed. – vag Sep 23 '20 at 17:53
  • I'm having a hard time understanding what "I cannot elevate to sudo with anything" looks like exactly - can you provide a specific example of a sudo command that you tried, and the resulting errors? Also please [edit] your question to include the output of ls /etc/sudoers.d/ – steeldriver Sep 23 '20 at 18:06
  • Hi steerldriver. Updated question. Please see example commands below:

    vag@ns1:/home/vag$ sudo vi /etc/passwd [sudo] password for vag: Sorry, try again. [sudo] password for vag: Sorry, try again. [sudo] password for vag: sudo: 2 incorrect password attempts vag@ns1:/home/vag$ sudo su [sudo] password for vag: Sorry, try again. [sudo] password for vag: Sorry, try again. [sudo] password for vag:

    – vag Sep 23 '20 at 18:26
  • Try this solution: https://askubuntu.com/questions/24006/how-do-i-reset-a-lost-administrative-password – SimpliFixed Sep 23 '20 at 21:41
  • Hi LinuxSurfaceNut. Clarification, I know the root password. The problem is that I cannot use sudo so I have to become root every time I need to do something which requires more privileges. – vag Sep 23 '20 at 21:52

1 Answers1

0

I finally got around this by putting rules inside /etc/sudoers.d/ files.

vag
  • 41