LoginSignup
8
9

More than 5 years have passed since last update.

sudo のパスワードを聞かれないようにする

Last updated at Posted at 2017-03-03
  • 毎回 sudo のパスワードを入力するのが面倒なときは、/etc/sudoers のファイルを編集します。
    • ユーザ inohana に NOPASSWD を追加。
  • このファイルは sudo visudo という特殊なコマンドでのみ変更が可能です。
    • このコマンドはデフォルトで sudoers 編集用になっているので対象ファイルの指定は不要。
inohana@ino-ubuntu:~$ sudo cat /etc/sudoers
[sudo] password for inohana:
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL
user01  ALL=NOPASSWD: ALL
inohana ALL=NOPASSWD: ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d
8
9
1

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
8
9