sudoユーザを追加する方法
[Note]
1. /etc/sudoers ファイルに sudoコマンドを利用できるユーザを追加。
2. /etc/sudoers ファイルには予めsudoコマンドを利用できるグループが
用意されている。
(ex) Debian: sudoグループ, CentOS/Fedora: wheelグループ
※Fedora24の場合、上記ファイルは以下のようになっている。
# Allow members of group sudo to execute any command
% wheel ALL = (ALL: ALL) ALL
2にユーザを追加すると、sudoコマンドを利用できるようになる。
[追加手順]
1. usermodコマンドでログインユーザ(自分)をwheelグループに追加。
# usermod -a -G wheel (sudo) username -> (login user or 自分)
2. sudoコマンドが使用可能か確認。
(ex) sudo dnf install (search or info) package_name
3. 2で指定したユーザのパスワード入力を促され、コマンドを実行
できればOK。
[参考サイト]
[補足]
/etc/sudoers にwheelまたはsudoグループが用意されていない
場合、rootの下に追加したいユーザ名を登録する。
-> ない場合はだいたいコメントアウトされている。
## Next comes the main part: which users can run what software on
## which machines (the sudoers file can be shared between multiple
## systems).
## Syntax:
##
## user MACHINE=COMMANDS
##
## The COMMANDS section may have other options added to it.
##
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
username ALL=(ALL) ALL