Skip to content

Instantly share code, notes, and snippets.

@the-paulus
Created May 25, 2017 18:26
Show Gist options
  • Save the-paulus/a361434b7f240f5b9f73867593168145 to your computer and use it in GitHub Desktop.
Save the-paulus/a361434b7f240f5b9f73867593168145 to your computer and use it in GitHub Desktop.
Creates a listing of entries for ssh's config file used for public/private key authentication.
while IFS='' read -r line || [[ -n "$line" ]]
do
user=$(echo $line | cut -d: -f 1)
domain=$(echo $line | cut -d' ' -f 2)
printf "\n\nHost $domain\n\tHostName $domain\n\tPort 22222\n\tUser $user\n\tIdentityFile ~/.ssh/id_rsa"
done < /etc/domainusers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment