4

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?

Zanna
  • 70,465
Sandra
  • 151
  • 1
    What permissions does the ubuntu user have? Did you try to reload the service with root permissions, for example using sudo? – Henning Kockerbeck Nov 01 '16 at 22:56
  • when trying to use sudo i get this one sudo: unable to resolve host server-1. And about ubuntu idk, it just gave me this login once server were created – Sandra Nov 01 '16 at 22:58
  • when I try to login to user as root i get this message Please login as the user "ubuntu" rather than the user "root". – Sandra Nov 01 '16 at 22:58
  • 1
    As far as unable to resolve host server-1 is concerned, this might help you: http://askubuntu.com/questions/59458/error-message-when-i-run-sudo-unable-to-resolve-host-none But you may be unable to edit the respective files and set the host name. Maybe you should ask OVHs support, they'd know their specific setup best. – Henning Kockerbeck Nov 01 '16 at 23:36

4 Answers4

4

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)

S.M.Mousavi
  • 1,136
2

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

sudo apt-get remove libpolkit-agent-1-0
Zanna
  • 70,465
viksit
  • 121
1

You can find syntax error by this command -

sudo apache2ctl configtest

Fix the error. And things will work.

0

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.

Toir
  • 19
  • 5