Authentication error while restarting apache

I'm connecting to my cloud server (OVH) using SSH key and now I'm trying to restart apache and gets this error:

ubuntu@server-1:~$ service apache2 reload
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to reload 'apache2.service'.
Authenticating as: Ubuntu (ubuntu)
Password:
polkit-agent-helper-1: pam_authenticate failed: Authentication failure
==== AUTHENTICATION FAILED ===
Failed to reload apache2.service: Access denied
See system logs and 'systemctl status apache2.service' for details.

How to solve it?

4

4 Answers

You must run that command using sudo as follow:

sudo service apache2 reload

Update:
If you have sudo: unable to resolve host server-1 problem, so you need to fix your hostname through /etc/hostname and /etc/hosts and reboot your linux machine to take affect. then retry above command again.
More details about this problem: Error message when I run sudo: unable to resolve host (none)

One option is to disable policykit (if you know what you're doing) via

sudo apt-get remove libpolkit-agent-1-0

You can find syntax error by this command -

sudo apache2ctl configtest

Fix the error. And things will work.

I took the list through this command sudo apache2ctl configtest and disable all warnings (with a2dissite <virtual_host_name>). And sudo systemctl restart apache2 or sudo systemctl start apache2 and my apache server started working.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like