0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Ubuntuでsudoするときのパスワード入力を省略する

Last updated at Posted at 2018-08-29

はじめに

本当にsudoをパスワードなしで実行していいか100回自問自答する

設定変更

sudoしたいユーザでログインして下記実施

cat << EOF | sudo tee /etc/sudoers.d/$(logname) >> /dev/null
$(logname) ALL=(ALL) NOPASSWD:ALL
EOF

確認

cat /etc/sudoers.d/$(logname)
doQiita ALL=(ALL) NOPASSWD:ALL

NOPASSWD:ALLALL の部分を任意のコマンド(フルパス)に置き換えると任意のコマンドだけパスワード不要になる
例:NOPASSWD:/sbin/shutdown

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?