Add BMC account password under Linux system

Source: Internet
Author: User
Tags true true

Requirements: Known BMC account id2 as root admin account, add id5bmcroot account

Tool: Ipmitool version 1.8.14

System: CentOS Release 6.6 (Final)

1. Install Ipmitool installation source via Yum

Yum Install Ipmitool

2, manual installation of 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. el5.x86_64.rpm.
/sbin/modprobe ipmi_msghandler/sbin/modprobe ipmi_devintf/sbin/ Modprobe ipmi_poweroff/sbin/modprobe ipmi_watchdog/sbin/modprobe Ipmi_si

3, new Ip.csv file, will BMC userid (first column), username (second column), UserPassword (third column), User name permission (fourth column)

User_id,user_name,user_password,user_priv 2, Jdroot,5t^y7u*i,23, Yewu,yewu,35, Bmcroot,longgewudi,4

4, edit ipmitool_adduser_inband.sh

#!/bin/version bash# and date edited=1.0.0modify_date=20170830#帮助信息函数functionPrinthelp () {Echo "Tool Version: $VERSION ($MODIFY _date)"    Echo "usage:$0-i User_conf_file"} #如果脚本执行时加上-h parameter, the Help information is printed Case$1 inch-h|--Help ) Printhelp exit0                ;; Esac#获取执行脚本时的-i option parameter, assign the parameter to user_conf_file# if the script option parameter is not-I, then exit directly whileGetopts": I:"opt Do     Case$optinchi) User_conf_file=$OPTARGEcho "User config file is"$USER _conf_file;; *)             Echo "argument error"Exit1;; Esac Done#判断有没有给USER_CONF赋值, no, then exit directly.if[${#USER_CONF_FILE}-eq0 ] Then    Echo "Please assign config file. detail Info check-h"Exit0fi#脚本把日志输出到add_user_result. log file Log_file="Add_user_result.log"Declare-I. i=0#循环读取文件 forLineinch`Cat$USER _conf_file '; Do{((I=i+1))        if[$i-eq1 ]     ThenContinuefi#简单的判断某行的有效性, if the length of the read to a row is less than 10, exit directlyif[${#LINE}-ltTen ]     ThenExit0; fi#把变量清空, assign a value to the variable user_id=""user_name=""user_passwd=""User_priv=""user_id=`Echo$LINE |awk-F,'{print $}'' user_name=`Echo$LINE |awk-F,'{print $}'' user_passwd=`Echo$LINE |awk-F,'{print $}'' User_priv=`Echo$LINE |awk-F,'{print $4}'|sed 's/\r//g'`        #    Echo "user password $USER _passwd"#判断从文件中读取到的数据是否是空, if you exit directly, the script stops runningif[${#USER_ID}-eq0] || [${#USER_NAME}-eq0] || [${#USER_PASSWD}-eq0] ||[${#USER_PRIV}-eq0 ]     Then        Echo "Please check data valid of file $USER _conf_file file"Exit0    fi#增加用户名, password and set the corresponding permissions Ipmitool user set name $USER _id $USER _name ipmitool user Set password $USER _id $USER _pa SSWD 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} DoneEcho "ipmitool user List 1"|Tee-a $LOG _fileipmitool user list1|Tee-a $LOG _fileEcho "Ipmitool user List 8"|Tee-a $LOG _fileipmitool user list8Echo "Add all user name Success"|Tee-A $LOG _file

5, perform ipmitool_adduser_inband.sh-i ip.csv

[Email protected]]#./ipmitool_adduser_inband. sh -file is Ip.csv

6. View the results after execution

1 ID  Name             callin  Link Auth  IPMI Msg   Channel Priv Limit2   jdroot           true     True       true        USER3   Yewu          true            true True        OPERATOR5   bmcroot          true    true       True        ADMINISTRATOR

Add BMC account password under Linux system

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.