[oracle@localhost ~]$ sudo yum -y install unzip
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
[sudo] password for oracle:
oracle is not in the sudoers file. This incident will be reported.
Oracleユーザーがrootとしてコマンドを実行できるように、sudoersを構成します。
ステップ1:rootユーザーの下でsudoers構成ファイルを編集します。ホイールグループに関連する構成情報の前にあるコメント記号「#」を削除します。wheelグループに属するすべてのユーザーに、rootユーザーのすべてのコマンドを実行する権限を与えます。
[root@localhost ~]# visudo
-------------修改前---------------
#%wheel ALL=(ALL) ALL
# Same thing without a password
#%wheel ALL=(ALL) NOPASSWD: ALL
-----------修改后-----------------
%wheel ALL=(ALL) ALL
# Same thing without a password
%wheel ALL=(ALL) NOPASSWD: ALL
手順2:oracleユーザーをwheelグループに追加し、グループファイルで「wheel」キーワードの行レコードを見つけます。
wheelレコードの後に「、oracle」を追加して、oracleユーザーをwheelグループに追加します。
[root@localhost ~]# vi /etc/group
wheel:x:10:root,oracle
ステップ3:テスト
「id」コマンドを使用して、sudoコマンドの使いやすさを簡単にテストできます。
oracleユーザーは、idコマンドを使用して現在のユーザー情報を取得します。
[oracle@secdb1 ~]$ id
uid=500(oracle) gid=501(oinstall) groups=10(wheel),500(dba),501(oinstall)
sudoの詳細な設定方法については、man sudo
独自のクエリを使用できます