0

apologies for a dummy question: On my CentOS 7.5 I've added my user to a wheel group and in visudo uncommented the line that wheel members can run all commands without a password. Logged in/out but it doesn't work. Added my user explicitly to run all commands without the password, logged in/out, still doesn't work. What am I doing wrong here? Many thanks in advance!

8
  • 3
    Can you show us the line for your user from /etc/passwd and the respective sudoers-file? (Please make sure that your system does not save the password hash in the passwd file, otherwise cut it out....). Does visudo -c show any errors?
    – FelixJN
    Sep 6, 2019 at 9:06
  • my user is clusteradm [clusteradm@master ~]$ groups clusteradm wheel through visudo this is defined: ## Allows people in group wheel to run all commands %wheel ALL=(ALL) ALL ## Same thing without a password %wheel ALL=(ALL) NOPASSWD: ALL [root@master clusteradm]# visudo -c /etc/sudoers: parsed OK /etc/sudoers.d/waagent: parsed OK [root@master sudoers.d]# cat waagent clusteradm ALL = (ALL) ALL Sep 6, 2019 at 9:43
  • there are several shadow files in /etc (I thought should be just one): [clusteradm@master ~]$ ls /etc | grep shadow gshadow gshadow- shadow shadow- in /etc/shadow i see this: root:*LOCK*:14600:::::: clusteradm:longhashedpasswordremoved/:18137:0:99999:7::: in /etc/passwd: root:x:0:0:root:/root:/bin/bash clusteradm:x:1000:1000::/home/clusteradm:/bin/bash Sep 6, 2019 at 9:43
  • Please put those updates into your question where (a) you can format them as code with the {} button, and (b) it's easier for us to read and consequently help you. Sep 6, 2019 at 10:56
  • These seem fine. How do you initialize the commands?
    – FelixJN
    Sep 6, 2019 at 11:55

1 Answer 1

1

Possibly, if anyone still needs the answer, I also encountered the same situation and managed to cope with the problem following way:

In the section "example entries" of the arch-wiki for sudo command https://wiki.archlinux.org/index.php/Sudo

There is a possible variant:

  1. Open your sudoers file with sudo visudo
  2. After the Defaults section (was commented in my file) add the following line

Defaults:%wheel !authenticate

Also, if you want to enable passwordless sudo for a particular user, you can add the next line instead: Defaults:YOUR_USERNAME !authenticate where YOUR_USERNAME should be replaced with your username.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .