【问题标题】:How do I run systemctl restart apache2 in AWS Ubuntu when it requires a password [closed]当需要密码时,如何在 AWS Ubuntu 中运行 systemctl restart apache2 [关闭]
【发布时间】:2018-10-02 15:44:57
【问题描述】:

我正在尝试重新启动 Apache,但我得到...

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)

这是一个全新的实例,我从未设置过 ubuntu 用户密码。创建实例时是否设置了默认密码?

如何在 AWS Ubuntu 中重启 apache?

【问题讨论】:

    标签: amazon-web-services ubuntu apache2


    【解决方案1】:

    如果您在创建实例时设置了密钥对,则用户 ubuntu 没有密码,也没有启用基于密码的登录。您必须使用您的密钥对登录。

    要执行需要提升权限的命令,请在命令前使用sudo。重启 apache2 的实际命令取决于您使用的 Linux 发行版和版本。

    sudo systemctl restart apache2

    sudo service apache2 restart

    【讨论】:

    • 我错过了 sudo,这就是它要求输入密码的原因。
    猜你喜欢
    • 2018-09-28
    • 2020-03-30
    • 1970-01-01
    • 1970-01-01
    • 2022-10-25
    • 2021-10-20
    • 2017-04-07
    • 1970-01-01
    • 2015-02-27
    相关资源
    最近更新 更多