Module epiclass.utils.ssh_utils

Utility functions for SSH and SCP.

Functions

def createSCPClient(ssh_client: paramiko.SSHClient)

Create SCP client from paramiko. Needs to be closed later.

Use this with scp.get and scp.put.

def createSSHClient(hostname: str, port: int, username: str)

Create SSH client from paramiko. Needs to be closed later.

def run_commands_via_ssh(cmds: List[str], hostname: str, port: int, username: str, verbose: bool = True) ‑> List[~T]

Run a command on a remote server via SSH using SSH key authentication and return the decoded result.

Args

hostname : str
The hostname of the remote server.
port : int
The port number for the SSH service.
username : str
The username for SSH login.
verbose : bool
To print executed commands.

Returns

list
The decoded output of the commands.