Solaris 10 5/09 インストールガイド (カスタム JumpStart/ 上級編)

終了スクリプトによるシステムのルートパスワードの設定

Solaris ソフトウェアのシステムへのインストールが完了すると、システムは再起動します。ブートプロセス終了前に、システムは root パスワードを入力するように求めてきます。パスワードを入力するまで、システムはブート処理を終了できません。

set_root_pw という終了スクリプトが、auto_install_sample ディレクトリに保存されています。この終了スクリプトは、プロンプトを表示することなく root パスワードを自動的に設定する方法を示します。set_root_pw については、例 4–6 を参照してください。


注 –

システムの root パスワードを終了スクリプトで設定した場合、ユーザーが、終了スクリプト内にある暗号化されたパスワードからルートのパスワードを発見しようと試みる可能性があります。ユーザーに root パスワードを解読されないよう、対策を講じてください。



例 4–6 終了スクリプトによるシステムの root パスワードの設定

	 #!/bin/sh
	 #
	 #       @(#)set_root_pw 1.4 93/12/23 SMI
	 #
	 # This is an example Bourne shell script to be run after installation.
	 # It sets the system's root password to the entry defined in PASSWD.
	 # The encrypted password is obtained from an existing root password entry
	 # in /etc/shadow from an installed machine.
 
	 echo "setting password for root"
 
	 # set the root password
 PASSWD=dKO5IBkSF42lw
	 #create a temporary input file
 cp /a/etc/shadow /a/etc/shadow.orig
 
	 mv /a/etc/shadow /a/etc/shadow.orig
 	nawk -F: '{
         if ( $1 == "root" )
           printf"%s:%s:%s:%s:%s:%s:%s:%s:%s\n",$1,passwd,$3,$4,$5,$6,$7,$8,$9
      else
		        printf"%s:%s:%s:%s:%s:%s:%s:%s:%s\n",$1,$2,$3,$4,$5,$6,$7,$8,$9
      }' passwd="$PASSWD" /a/etc/shadow.orig > /a/etc/shadow
 #remove the temporary file
 rm -f /a/etc/shadow.orig
 # set the flag so sysidroot won't prompt for the root password
 sed -e 's/0 # root/1 # root/' ${SI_SYS_STATE} > /tmp/state.$$
  mv /tmp/state.$$ ${SI_SYS_STATE}

次に、この例のいくつかのコマンドの説明を示します。