権限のないユーザーを使用してApacheを再起動する方法

権限のないユーザーを使用してApacheを再起動する方法

CentOS 7 AWS インスタンスを使用します。すべての場合に次の問題があります

===================================================
[oms.deployer.acc@********* ~]$ service httpd restart
Redirecting to /bin/systemctl restart httpd.service
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to manage system services or units.
Multiple identities can be used for authentication:
Cloud User (ec2-user)
oms.deployer.acc
Choose identity to authenticate as (1-2):
===========================================================

oms.deployer.acc静的ユーザーを使用しようとしており、ホイールアクセスも持っています。

一般ユーザーとしてhttpdサービスを再起動する必要があります。

ベストアンサー1

私は自転車を発明する最も簡単な方法はお勧めできないと思いますsudo。ユーザーには限られた数のコマンドを引き続き提供できますsystemctl restart httpdvisudo

# visudo

次の行を追加します。

nonprivuser ALL=(ALL) NOPASSWD: /bin/systemctl restart httpd

ファイルを保存してテストします。

# su - nonprivuser
$ sudo /bin/systemctl restart httpd

おすすめ記事