Push Your SSH Public keys using Fabric

Published on April 30, 2009, 10:45 a.m.

fabric python

This came across my twitter radar today from @bitprophet (aka: Jeff Forcier), who just happens to be the new maintainer for Fabric:

def push_key():
keyfile = '/tmp/%s.pub' % env.user
run('mkdir -p ~/.ssh && chmod 700 ~/.ssh')
put('~/.ssh/id_rsa.pub', keyfile)
run('cat %s >> ~/.ssh/authorized_keys' % keyfile)
run('rm %s' % keyfile)


Everything you need to push your public key to an external server using Fabric.
comments powered by Disqus