Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fabric example for SSH keyfile connection
from fabric.api import *
env.hosts = ['host.name.com']
env.user = 'user'
env.key_filename = '/path/to/keyfile.pem'
def local_uname():
local('uname -a')
def remote_uname():
run('uname -a')
@aubricus

This comment has been minimized.

Copy link

@aubricus aubricus commented Mar 14, 2013

Thanks for the gist. You can also accomplish this via an ssh-config. I've forked your gist to show how.

@satels

This comment has been minimized.

Copy link

@satels satels commented Jun 26, 2017

How to gen /path/to/keyfile.pem ?

@karthikvee

This comment has been minimized.

Copy link

@karthikvee karthikvee commented Jan 17, 2019

Despite defining the env.hosts = ['host-name.fqdn-format']. Following input is asked during execution:
No hosts found. Please specify (single) host string for connection:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment