Last active
January 5, 2017 19:45
-
-
Save bahamat/b2f5194d151a352eaed7 to your computer and use it in GitHub Desktop.
Find the SmartDataCenter default root password for any installed platform image.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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