How to give permission to execute a command v-restart-service

Hello, I want to give the user permission to execute the v-restart-service command, I added the line to /etc/sudoers.d/username:

admin ALL=NOPASSWD:/usr/local/hestia/bin/v-restart-service apache2

But I still cannot execute the command (Permission denied), tell me what I’m doing wrong please

Thank you!

admin ALL=NOPASSWD:/usr/local/hestia/bin/v-restart-service

should work fine

Still does not work, asks for root password, also tried to restart the server, also did not help

jaap ALL=NOPASSWD:/usr/local/hestia/bin/v-restart-service

This works fine on my server…

I don’t know why, but I can’t
here is the /etc/sudoers.d/admin file:

# Created by hestia installer

Defaults env_keep=“VESTA”
Defaults env_keep+=“HESTIA”
Defaults:admin !syslog
Defaults:admin !requiretty
Defaults:root !requiretty

# sudo is limited to hestia scripts
admin ALL=NOPASSWD:/usr/local/hestia/bin/v-restart-service
admin ALL=NOPASSWD:/usr/local/vesta/bin/*
admin ALL=NOPASSWD:/usr/local/hestia/bin/*

On behalf of the user, I execute the command:

/usr/local/hestia/bin/v-restart-service apache2

Here’s the answer

==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to restart ‘apache2.service’.
Authenticating as: root
Password:

Am I doing everything right?

admin should be allready allowed to restart see:

admin ALL=NOPASSWD:/usr/local/hestia/bin/*

I thought so too, and tried to execute the commands first, but without success, I decided to try to add a specific command, what could be wrong? I have another admin.save file next to the sudoerd.d/admin file, maybe this is the issue? but there are also these commands

Could this be because the path /usr/local/hestia/bin/ is root ?

just in case… you still need to use sudo with the command itself and that’s what you do, right?

also be aware that sudo does not ask for the root password but the user password and only when you first call it…

Thanks for the clarification, I’ll try. I’m just going to deploy updates through the user using the deployer tool, and I would need to restart Apache after deploying, you say after one password entry it will not ask for more, or will it happen every time?