LoginSignup
1
1

More than 3 years have passed since last update.

ipmitoolのパスワード指定オプションについて

Posted at

サーバーのリモート管理でipmitoolを使う際、-Pオプションでパスワードをコマンドラインの中で指定すると画面上で丸見えですね。ipmitoolにはパスワード関連で-a-E-fオプションがあるのでまとめておきます。

-P <password>

-PオプションはBMCのパスワードをコマンドラインで指定します。サポートされている場合、ps auxなどのプロセスリストではパスワードが非表示になります。man ipmitool(1)でもこのオプションは非推奨ですね。

# ipmitool -I lanplus -H 172.25.130.28 -U user -P password sol activate
[SOL Session operational.  Use ~? for help]


# ps aux
root      353369  0.0  0.1   8900  2236 pts/1    S+   19:23   0:00 ipmitool -I lanplus -H 172.25.130.28 -U user -P XXXXXXXXXX sol activate

-a

-aオプションはコマンド実行前にBMCパスワードの入力を求めるプロンプトを表示します。OSのログインプロンプトと同じで入力したパスワードは非表示です。ipmitoolを対話的に使う場合はこれもありですね。

# ipmitool -I lanplus -H 172.25.130.25 -U user -a fru
Password: 

-E

-Eオプションは環境変数IPMI_PASSWORDに設定した値を読み取りパスワードとしてコマンドを実行します。これはprintenvを実行すると見えてしまいますね。変数名も分かりやすいですしね。

# ipmitool -I lanplus -H 172.25.130.25 -U user -E fru
Unable to read password from environment
Password: 
#
# 
# export IPMI_PASSWORD=password
# 
# ipmitool -I lanplus -H 172.25.130.25 -U user -E fru
#
# printenv 
SHELL=/bin/bash
HISTCONTROL=ignoredups
...
IPMI_PASSWORD=password

-f

ファイルにBMCのパスワードを保存し、そのファイルを-fオプションで指定しコマンドを実行します。chmod 400などとしておけば他のアカウントからは読み書きできず安全ですね。

# echo password > pwfile.txt
# 
# chmod 400 pwfile.txt
#
# ls -l
total 8
-rw-------. 1 root root 1420 Oct 24 21:02 anaconda-ks.cfg
-r--------. 1 root root   11 Dec  3 19:49 pwfile.txt
# 
# ipmitool -I lanplus -H 172.25.130.25 -U admin -f ./pwfile.txt fru
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1