Skip to content

Instantly share code, notes, and snippets.

@shanesveller
Created November 21, 2008 19:30
Show Gist options
  • Save shanesveller/27580 to your computer and use it in GitHub Desktop.
Save shanesveller/27580 to your computer and use it in GitHub Desktop.
Sake task to copy your DSA SSH pubkey to a remote host's authorized_keys
desc 'Copy ssh-key to authorized_keys on $HOST for $USER'
task 'ssh:keys' do
host = (ENV["HOST"]
user = (ENV["USER"]
if (host and user) then
sh("ssh #{user}@#{host} 'mkdir -p .ssh/'")
sh("cat .ssh/id_dsa.pub | ssh #{user}@#{host} 'cat >> .ssh/authorized_keys'")
end
end
# Example usage:
# sake ssh:keys HOST=mywebsite.com USER=deploy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment