paramiko.client.SSHClient.exec_command

SSHClient.exec_command(command, bufsize=-1, timeout=None, get_pty=False)

Execute a command on the SSH server. A new .Channel is opened and the requested command is executed. The command’s input and output streams are returned as Python file-like objects representing stdin, stdout, and stderr.

Parameters:
  • command (str) – the command to execute
  • bufsize (int) – interpreted the same way as by the built-in file() function in Python
  • timeout (int) – set command’s channel timeout. See Channel.settimeout.settimeout
Returns:

the stdin, stdout, and stderr of the executing command, as a 3-tuple

Raises SSHException:
 

if the server fails to execute the command

Navigation