SSH Agent

SSH agent module of ParallelSSH

class pssh.agent.SSHAgent

paramiko.agent.Agent compatible class for programmatically supplying an SSH agent

Example Usage

from pssh.agent import SSHAgent
from pssh.utils import load_private_key
from pssh import ParallelSSHClient

agent = SSHAgent()
agent.add_key(load_private_key('my_private_key_filename'))
agent.add_key(load_private_key('my_other_private_key_filename'))
hosts = ['my_host', 'my_other_host']

client = ParallelSSHClient(hosts, agent=agent)
client.run_command('uname')
add_key(key)

Add key to agent.

Parameters:key (paramiko.pkey.PKey) – Key to add
get_keys()

Return the list of keys available through the SSH agent, if any. If no SSH agent was running (or it couldn’t be contacted), an empty list will be returned.

Returns:a tuple of .AgentKey objects representing keys available on the SSH agent