Skip to content

Instantly share code, notes, and snippets.

@GeorgeErickson
Created November 19, 2012 20:37
Show Gist options
  • Save GeorgeErickson/4113720 to your computer and use it in GitHub Desktop.
Save GeorgeErickson/4113720 to your computer and use it in GitHub Desktop.
iCloud ssh config generator
#!/usr/bin/env bash
#
#Shitty script to create a ssh config entry for icloud
HOSTNAME=$(echo show Setup:/Network/BackToMyMac | scutil | egrep "[0-9]{1,}.members.btmm.icloud.com" -o)
COMPUTER_NAME=$(scutil --get ComputerName)
RED=$(tput setaf 9)
RESET=$(tput sgr0)
echo "${RED}Add the following to your .ssh/config (you probably also have to mess with your sharing preferences):
$RESET
Host $COMPUTER_NAME
User $USER
HostName $COMPUTER_NAME.$HOSTNAME
AddressFamily inet6
Protocol 2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment