Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I run systemctl restart apache2 in AWS Ubuntu when it requires a password [closed]

I am trying to restart Apache and I get...

ubuntu@ip-172-xx-xx-xx:~$ systemctl restart apache2
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to restart 'apache2.service'.
Authenticating as: Ubuntu (ubuntu)

This is a brand new instance and I never set the ubuntu user password. Is there a default password set on instance creation?

How do I restart apache in AWS Ubuntu?

like image 712
Jackie Avatar asked Oct 17 '25 17:10

Jackie


1 Answers

If you setup a key pair for your instance on creation, then there is no password for the user ubuntu nor is password based login enabled. You must login using your key pair.

To execute commands that require elevated permissions, use sudo in front of your command. The actual command to restart apache2 depends on which Linux distribution and version you are using.

sudo systemctl restart apache2

or

sudo service apache2 restart

like image 198
John Hanley Avatar answered Oct 20 '25 07:10

John Hanley



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!