OrangePi-PCを使ってみる

パスワード無しでsudoコマンドを実行する

パスワード無しでsudoコマンドを実行するためには、/etc/sudoersの末尾に、
ユーザ名 ALL=(ALL) NOPASSWD: ALL
を加えます。/etc/sudoersの修正には専用のコマンドを使いま す。

$ sudo visudo

例えば、orangepiユーザにこの権限を与える場合は

orangepi ALL=(ALL) NOPASSWD: ALL

を追加します。
変更後の「/etc/sudoers」は以下の様になります。

#
# 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

# 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
orangepi ALL=(ALL) NOPASSWD: ALL