ブートマネージャ「GRUB」では、カーネルを起動させる前に、パスワード入力をさせることができる。クライアント用途で使用している場合、ほとんど再起動させることのないサーバなど、予期せぬ再起動に備えることが可能だ。
すでにLILOでの方法を「セキュリティ強化のためLILOにパスワードを設定する」Tipsで解説しているが、このような手法では、設定ファイルを覗かれるだけでパスワードが見破られてしまう。そこで、暗号化の1つとして比較的安全なMD5 sumを使い、その文字列をGRUBの設定ファイル内に貼り付ければよい。
|
grub> md5crypt Password: ******** Encrypted: d41d8cd98f00b204e9800998ecf. |
手順に進もう。まず最初に、GRUBのプロンプト表示段階で上記のように「md5crypt」と入力する。最後に表示される行の「Encrypted: 」に続く文字列が、暗号化されたパスワードだ。この文字列を、次に挙げる/boot/grub/grub.confファイル内にペーストする。挿入する個所は、次の例を目安に任意の個所で構わない。
|
# vi /boot/grub/grub.conf # grub.conf generated by anaconda # # Note that you do not have to rerun grub after making changes to this file # NOTICE: You have a /boot partition. This means that # all kernel and initrd paths are relative to /boot/, eg. # root (hd0,0) # kernel /vmlinuz-version ro root=/dev/hda2 # initrd /initrd-version.img #boot=/dev/hda password --md5 d41d8cd98f00b204e9800998ecf. default=0 timeout=10 splashimage=(hd0,0)/grub/splash.xpm.gz title Red Hat Linux (2.4.18-18.8.0) root (hd0,0) kernel /vmlinuz-2.4.18-18.8.0 ro root=LABEL=/ initrd /initrd-2.4.18-18.8.0.img 〜以下略〜 |
変更後は、reboot(shutdown -r now)などと指定し、OSを再起動させてみよう。
Copyright © ITmedia, Inc. All Rights Reserved.