Skip to content

Instantly share code, notes, and snippets.

@delcypher
Created July 7, 2017 14:39
Show Gist options
  • Save delcypher/cc0f72b386918096f303be4e0aeee2ce to your computer and use it in GitHub Desktop.
Save delcypher/cc0f72b386918096f303be4e0aeee2ce to your computer and use it in GitHub Desktop.
Enable iDRAC web access ADMIN privilidge
#!/bin/bash
# Based on http://lists.us.dell.com/pipermail/linux-poweredge/2013-April/047905.html
set -x
set -e
set -o pipefail
function usage() {
echo "$0 <user_id>"
}
if [ $# -ne 1 ]; then
usage
exit 1
fi
userid="$1"
if [ $(echo "${userid}" | grep -Ec '0x[a-f0-9]{2}') -ne 1 ]; then
echo "Invalid user ID"
exit 1
fi
reservation_id=$(ipmitool raw 0x2e 0x01 0xa2 0x02 0x00)
reservation_id_hex=$(echo "${reservation_id}" | sed 's/[ ]*\([a-f0-9]\{2\}\)/ 0x\1/g')
reservation_id_args=(${reservation_id_hex})
echo "Reservation id is \"${reservation_id_args[*]}\""
sleep 1
# Make admin
# Last bytes
# >> 0x01 0x00 0x00 0x00 - Set iDRAC User to READONLY
# >>
# >> 0xf3 0x01 0x00 0x00 - Set iDRAC User to OPERATOR
# >>
# >> 0xff 0x01 0x00 0x00 - Set iDRAC User to Administrtor
ipmitool raw 0x2e 0x03 "${reservation_id_args[@]}" 0x04 ${userid} 0x00 0x00 0x01 0x09 0x00 0x01 0x01 0x00 0xff 0x01 0x00 0x00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment