sudo をインストール
su で root になってあれこれ作業をするのもなんなので、sudo を使おうと思ったら入ってないのね。あれこれ色々と入っているようで、実際には結構ないものが多いのかな? というわけで sudo をインストールしよう。
debian:/home/paraches# apt-get install sudo パッケージリストを読みこんでいます... 完了0% 依存関係ツリーを作成しています... 完了% 以下のパッケージが新たにインストールされます: sudo アップグレード: 0 個、新規インストール: 1 個、削除: 0 個、保留: 0 個。 165kB のアーカイブを取得する必要があります。 展開後に追加で 401kB のディスク容量が消費されます。 取得:1 http://security.debian.org stable/updates/main sudo 1.6.8p7-1.3 [165kB] 165kB を 12s で取得しました (13.2kB/s) 未選択パッケージ sudo を選択しています。 (データベースを読み込んでいます... 現在 34057 個のファイルとディレクトリがインストールされています。) (.../sudo_1.6.8p7-1.3_powerpc.deb から) sudo を展開しています... sudo (1.6.8p7-1.3) を設定しています ... No /etc/sudoers found... creating one for you. debian:/home/paraches# which sudo /usr/bin/sudo
インストール官僚。使ってみる。
paraches@debian:~$ sudo apt-get update 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: paraches is not in the sudoers file. This incident will be reported.
ありゃりゃ、sudoers file に paraches が登録されていないと。
それじゃマニュアル読みましょうか。って、man sudo すると…日本語じゃん!
で、sudoers ファイルは /etc/sudoers だと。じゃ root で中身を見てみよう。
debian:/home/paraches# cat /etc/sudoers # /etc/sudoers # # This file MUST be edited with the 'visudo' command as root. # # See the man page for details on how to write a sudoers file. # # Host alias specification # User alias specification # Cmnd alias specification # User privilege specification root ALL=(ALL) ALL
あ、普通に編集しちゃいけないんだ。visudoって vi と sudo か?
debian:/home/paraches# visudo
やべ!使えない! GNU nanoって何? iPod nano? man nano しても解らなねぇ〜!
あれこれ触ってみてなんとなくわかった。そのまんま書けば良いんじゃん! vi みたいにモードがあるのかと思った。で、自分にまんま root の権限を。
# User privilege specification root ALL=(ALL) ALL paraches ALL=(ALL) ALL
これで su で root にならずに済むようになった。
paraches@debian:~$ sudo cat /etc/sudoers Password: # /etc/sudoers # # This file MUST be edited with the 'visudo' command as root. # # See the man page for details on how to write a sudoers file. # # Host alias specification # User alias specification # Cmnd alias specification # User privilege specification root ALL=(ALL) ALL paraches ALL=(ALL) ALL