Unable to see ifconfig output using paramiko
paramiko, python
Solution
Your server may be discriminating between interactive and non-interactive SSH sessions, running different startup scripts for the different sessions. Try running `echo $PATH` on the remote host through the paramiko SSH session and a regular interactive one and compare the outputs.
For a workaround you can do a `which ifconfig` on the remote server in an interactive session to get the absolute path and use that in your paramiko command.
stdin, stdout, stderr = dssh.exec_command('/abs/path/to/ifconfig')
NOTE On one of my hosts the result of `echo $PATH` from the paramiko SSH client was `/usr/bin:/bin`, while in an interactive session it was `/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin`, and `ifconfig` was indeed located in `/usr/sbin`, i.e. outside the path of the paramiko session.
Problem
I am using below code to execute commands on a remote machine, ``` import paramiko import os dssh = paramiko.SSHClient() dssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) dssh.connect('192.168.1.5', username='root', password='asdfghhh') import os stdin, stdout, stderr = dssh.exec_command('ls') print stdout.read() stdin, stdout, stderr = dssh.exec_command('ifconfig') print stdout.read() stdin, stdout, stderr = dssh.exec_command('ps') print stdout.read() dssh.close() ``` when I execute the program, Its able to show the ls and ps as well as other commands output. however ifconfig o/p is not observed. any idea how to solve this problems? Thanks in advance...