L
L
lyokhanych2021-03-29 22:44:34
linux
lyokhanych, 2021-03-29 22:44:34

Why does sudo ask for the root password?

Good afternoon,

Almost freshly installed OS (CentOS 8.3), let's say postfix is ​​on it.
I created a test user, I want to allow it to restart postfix, in the /etc/sudoers.d folder I create a test file, with the content:
test ALL = (root) /usr/bin/systemctl restart postfix.service I

save, when I try to execute the command,

60622d5d00a4e578579302.gif

I get a message in logs:

Mar 29 19:37:48 centos8 polkitd[815]: Registered Authentication Agent for unix-process:85080:1301031 (system bus name :1.583 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
Mar 29 19:37:51 centos8 unix_chkpwd[85112]: password check failed for user (root)
Mar 29 19:37:51 centos8 polkit-agent-helper-1[85092]: pam_unix(polkit-1:auth): authentication failure; logname= uid=1001 euid=0 tty= ruser=root rhost=  user=root
Mar 29 19:37:53 centos8 polkitd[815]: Operator of unix-process:85080:1301031 FAILED to authenticate to gain authorization for action org.freedesktop.systemd1.manage-units for system-bus-name::1.584 [/usr/bin/systemctl restart postfix.service] (owned by unix-user:test)
Mar 29 19:37:53 centos8 polkitd[815]: Unregistered Authentication Agent for unix-process:85080:1301031 (system bus name :1.583, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)


But if I enter the root password in the second attempt, then everything is OK:
Mar 29 19:37:56 centos8 polkitd[815]: Registered Authentication Agent for unix-process:85137:1301784 (system bus name :1.590 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
Mar 29 19:37:59 centos8 polkitd[815]: Operator of unix-process:85137:1301784 successfully authenticated as unix-user:root to gain ONE-SHOT authorization for action org.freedesktop.systemd1.manage-units for system-bus-name::1.591 [/usr/bin/systemctl restart postfix.service] (owned by unix-user:test)
Mar 29 19:38:00 centos8 polkitd[815]: Unregistered Authentication Agent for unix-process:85137:1301784 (system bus name :1.590, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)


Apparently, there is some connection with policykit + sudo, but where and how to fix it - there are no ideas (and whoever is in the subject is probably an easy task).
PS
All default files in terms of security - as with a fresh installation.

Thank you in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
planc, 2021-03-30
@lyokhanych

write sudo before the command

S
S-trace, 2021-03-31
@S-trace

The root password is requested not by sudo but by systemctl (because the user is not in the wheel group - if he were in it, it would ask for his personal password).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question