Skip to content

Instantly share code, notes, and snippets.

@suzukis
Created January 12, 2016 04:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suzukis/9143f0bd789905b22300 to your computer and use it in GitHub Desktop.
Save suzukis/9143f0bd789905b22300 to your computer and use it in GitHub Desktop.
AuthorizedKeysCommandで公開鍵リストをwebからダウンロードしてくる
#!/bin/sh
url='URL here'
home=`cat /etc/passwd |egrep ^${1}: |cut -d: -f6`
ssh_local_path="${home}/.ssh"
if [ ! -e $ssh_local_path ]; then
mkdir $ssh_local_path
fi
/usr/local/bin/curl -L $url | sed '/^$/d' | tee ${ssh_local_path}/authorized_keys.new
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment