Created
November 21, 2008 19:30
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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