当通过密钥对 ssh 进入时,在 EC2 上作为 Ubuntu 进行身份验证

99m*_*les 5 ubuntu amazon-ec2

我有一个 Ubuntu EC2 实例,我通过 ssh 密钥对通过 SSH 连接。

当我尝试重新启动 systemd 时,它会提示输入密码,而我没有。我不相信我设置了一个,我不知道它会是什么,因为我使用密钥对作为 ubuntu 用户进行连接:

ubuntu@ip-172-31-35-37:~$ systemctl daemon-reload
==== AUTHENTICATING FOR org.freedesktop.systemd1.reload-daemon ===
Authentication is required to reload the systemd state.
Authenticating as: Ubuntu (ubuntu)
Password:
polkit-agent-helper-1: pam_authenticate failed: Authentication failure
==== AUTHENTICATION FAILED ===
Failed to execute operation: Access denied
Run Code Online (Sandbox Code Playgroud)

我怎样才能使这项工作?

Tim*_*Tim 7

你需要 root 权限才能做到这一点。用

sudo systemctl daemon-reload
Run Code Online (Sandbox Code Playgroud)