bmc linux 默认密码_linux系统下添加BMC帐号密码

需求:已知BMC帐号id2为root管理员帐号,添加id5bmcroot帐号

工具:ipmitool version 1.8.14

系统:CentOS release 6.6 (Final)

1,通过yum安装ipmitool安装源

[root@zxl]# yum install ipmitool

2,手动安装ipmitool

wget http://172.20.65.166:88/Hardware/OpenIPMI-tools-2.0.16-11.el5.x86_64.rpm

rpm -ivh OpenIPMI-tools-2.0.16-11.el5.x86_64.rpm/sbin/modprobeipmi_msghandler/sbin/modprobeipmi_devintf/sbin/modprobeipmi_poweroff/sbin/modprobeipmi_watchdog/sbin/modprobe ipmi_si

3,新建ip.csv文件,将BMC的userid(第一列),username(第二列),userpassword(第三列),用户名权限(第四列)

user_id,user_name,user_password,user_priv2,jdroot,5t^Y7u*I,2

3,yewu,yewu,3

5,bmcroot,longgewudi,4

4,编辑ipmitool_adduser_inband.sh

#!/bin/bash

#版本和编辑日期

VERSION=1.0.0MODIFY_DATE=20170830#帮助信息函数functionprintHelp()

{echo "Tool Version:$VERSION($MODIFY_DATE)"

echo "Usage:$0 -i user_conf_File"}

#如果脚本执行时加上-h参数,则打印帮助信息case $1 in

-h|--help)

printHelp

exit0;;esac#获取执行脚本时的-i选项参数,把参数赋给user_conf_FILE

#若脚本的选项参数不是-i,则直接退出while getopts ":i:"optdo

case $opt ini)

USER_CONF_FILE=$OPTARGecho "user config file is"$USER_CONF_FILE

;;*)echo "argument error"exit1;;esac

done#判断有没有给USER_CONF赋值,没有则直接退出if [ ${#USER_CONF_FILE} -eq 0]then

echo "please assign config file. detail info check -h"exit0

fi#脚本把日志输出到add_user_result.log文件

LOG_FILE="add_user_result.log"declare-i i=0#循环读取文件for LINE in `cat$USER_CONF_FILE`;do{

((i=i+1))if [ $i -eq 1]thencontinuefi#简单的判断某行的有效性,如果读取到某行的长度小于10,则直接退出if [ ${#LINE} -lt 10]thenexit0;fi#把变量清空,给变量赋值

USER_ID=""USER_NAME=""USER_PASSWD=""USER_PRIV=""USER_ID=`echo $LINE | awk -F, ‘{print $1}‘`

USER_NAME=`echo $LINE | awk -F, ‘{print $2}‘`

USER_PASSWD=`echo $LINE | awk -F, ‘{print $3}‘`

USER_PRIV=`echo $LINE | awk -F, ‘{print $4}‘ | sed ‘s/\r//g‘`

#echo "user password $USER_PASSWD"#判断从文件中读取到的数据是否是空,若是,则直接退出,脚本停止运行if [ ${#USER_ID} -eq 0 ] || [ ${#USER_NAME} -eq 0 ] || [ ${#USER_PASSWD} -eq 0 ] ||[ ${#USER_PRIV}-eq 0]then

echo "please check data valid of file $USER_CONF_FILE file"exit0

fi#增加用户名,密码并设置对应权限

ipmitool user set name $USER_ID $USER_NAME

ipmitool user set password $USER_ID $USER_PASSWD

ipmitool user priv $USER_ID $USER_PRIV1ipmitool user priv $USER_ID $USER_PRIV8ipmitool channel setaccess1 $USER_ID callin=on ipmi=on link=on privilege=$USER_PRIV

ipmitool channel setaccess8 $USER_ID callin=on ipmi=on link=on privilege=$USER_PRIV

ipmitool user enable $USER_ID

}done

echo "ipmitool user list 1" | tee -a $LOG_FILE

ipmitool user list1 | tee -a $LOG_FILEecho "ipmitool user list 8" | tee -a $LOG_FILE

ipmitool user list8

echo "add all user name success" | tee -a $LOG_FILE

5,执行ipmitool_adduser_inband.sh -i ip.csv

[root@zxl]# ./ipmitool_adduser_inband.sh -i ip.csv

user configfile is ip.csv

6,查看执行后的结果

[root@zxl]# ipmitool user list 1ID Name Callin Link Auth IPMI Msg Channel Priv Limit2 jdroot true true trueUSER3 yewu   true true trueOPERATOR5 bmcroot true true true ADMINISTRATOR

你可能感兴趣的:(bmc,linux,默认密码)