Skip to content

Instantly share code, notes, and snippets.

@Ceasar Ceasar/
Created Feb 20, 2014

What would you like to do?
fab -H [hostname] [command]
from fabric.api import run
HOME = '/Users/ceasarbautista'
def authorize():
"""Authorize access to a remote machine.
Password checks will no longer be required.
Usage: fab -H [hostname] authorize
with open('%s/.ssh/' % HOME) as f:
public_key =
run('echo "%s" >> .ssh/authorized_keys' % (public_key,))
def alias(alias, user, hostname, port=22):
"""Set an alias for remote machine.
Usage: fab alias:alias,user,hostname,port
with open('%s/.ssh/config' % HOME, 'a') as f:
f.write('Host %s' % alias)
f.write('\n HostName %s' % hostname)
f.write('\n Port %s' % port)
f.write('\n User %s' % user)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.