Skip to content

Instantly share code, notes, and snippets.

@bahamat
Last active January 5, 2017 19:45
Show Gist options
  • Save bahamat/b2f5194d151a352eaed7 to your computer and use it in GitHub Desktop.
Save bahamat/b2f5194d151a352eaed7 to your computer and use it in GitHub Desktop.
Find the SmartDataCenter default root password for any installed platform image.
#!/bin/bash
if (( UID > 0 )); then
echo "You must elevate privileges."
exit 1
fi
usbkey_status=$(/opt/smartdc/bin/sdc-usbkey status)
passwd_file=/mnt/usbkey/private/root.password.$1
[[ "$usbkey_status" == "unmounted" ]] && /opt/smartdc/bin/sdc-usbkey mount > /dev/null
if [[ -f "$passwd_file" ]]; then
/usr/bin/cat "$passwd_file"
else
echo "Platform image $1 is not installed in this data center."
fi
[[ "$usbkey_status" == "unmounted" ]] && /opt/smartdc/bin/sdc-usbkey unmount
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment