Successfully able to create an SSH connection between my windows machine and an QNX (~linux) system.
Only command that gets any output (stdout) is 'pwd`.
# SSH Connection stuff
stdin, stdout, stderr = client.exec_command('pwd')
output = stdout.readlines()
error = stderr.readlines()
readback = [output, error]
for index, val in enumerate(readback):
readback = '\n'.join(val)
print("%s:\t%s") %(index, readback)
Sample output of 'pwd':
0: /home/rxm
1:
When I change the command from pwd
to ls
:
0:
1: ksh: ls: cannot execute - No such file or directory
I get this same error when trying other simple commands, e.g. pidin
, ifconfig
, etc.
All the necessary commands works when I use PuTTY and create an SSH connection.
Has anyone seen this behavior. Didn't have a whole luck when going the invoke.shell
route either. Thanks.
pwd
is probably built in to your shell, whereas all the other commands you're running are not. ls
is not found because $PATH
is not set, so you can either set the PATH
environment variable, or use a full path when invoking commands, such as /bin/ls
.