sudo
ログインしているユーザとは異なるユーザ権限で引数に指定したコマンドを実行するコマンド。このコマンドを実行するとパスワード入力を要求されるが、このパスワードは現在ログインしているユーザのパスワードである。
suコマンドと異なり、コマンドの実行が終了すると権限は元のユーザに戻る。
ファイル/etc/sudoersユーザを登録することで管理者権限でコマンドを実行できる。/etc/sudoersを編集するには管理者権限でvisudoを実行する。
利用例
makeしたプログラムをインストールする。
$ sudo make install passwrod:
WebサーバApacheを起動する。
$ sudo /usr/local/apache2/bin/apachectl start password:
初めてsudoを実行したときのメッセージ
$ sudo ls /root 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. Password:
許可されていないコマンドを実行したときのメッセージ
$ sudo df /root Sorry, user dorami is not allowed to execute '/bin/df /root' as root on beta.localdomain.
[コマンド]