Skip to content

Instantly share code, notes, and snippets.

@bakins
Created May 31, 2013 17:03
Show Gist options
  • Select an option

  • Save bakins/5686377 to your computer and use it in GitHub Desktop.

Select an option

Save bakins/5686377 to your computer and use it in GitHub Desktop.
#!/usr/bin/bash
if [[ ! -f /root/.ssh/authorized_keys ]]; then
authorized_keys=$(/usr/sbin/mdata-get root_authorized_keys)
if [[ -n ${authorized_keys} ]]; then
mkdir -p /root/.ssh
echo -e "${authorized_keys}" > /root/.ssh/authorized_keys
chmod 700 /root/.ssh
chmod 600 /root/.ssh/authorized_keys
fi
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment