How to get the output of the background process(while using ssh) on the terminal in the client machine in Python?
<p>I'm running a server (linux machine) which ssh (I am using paramiko module) to the client(linux machine) to execute "python clientsock.py" on the client machine for socket connection. (this is to eliminate manual work of running client socket program on each client)</p>

<p>Once the socket connection is established I am checking for bluetooth dongles connected to the client if the required dongles are found I'm sending bluetooth HCI raw commands from server to client to execute on the dongle via socket.</p>

<p>My requirement is:
when I send commands to the client over the socket, client should open/pop up the terminal and show the output of the command executed.</p>

<p>But what is happening at present is, when I run the server which ssh to the client and run "python clientsock.py" on the client, then server sends bluetooth commands to client, I don't get to see the output/logs of the command executed in the client machine.</p>

<p>Everything happens in background and final result is send to the server.</p>

<p>Could you please tell me how to get the output of the background process(while using ssh) on the terminal in the client machine?</p>

<p>Paramiko module code snippet used in server.</p>

<pre><code>client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(IP address,username,password)
cmd = 'python &lt;path for client socket program&gt;'
stdin, stdout, stderr = client.exec_command(cmd)
</code></pre>

<p>But the stdout in server gives the output on server, I want to see the output in the client machine terminal.</p>