shanesveller (owner)

Revisions

gist: 27580 Download_button fork
public
Description:
Sake task to copy your DSA SSH pubkey to a remote host's authorized_keys
Public Clone URL: git://gist.github.com/27580.git
Embed All Files: show embed
ssh-keys.sake.rb #
1
2
3
4
5
6
7
8
9
10
11
12
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