[paramiko] remote command info
Roman Yakovenko
roman.yakovenko at gmail.com
Wed Jan 27 11:18:00 PST 2010
On Wed, Jan 27, 2010 at 6:33 PM, james bardin <jbardin at bu.edu> wrote:
> On Wed, Jan 27, 2010 at 11:14 AM, stefano landucci
> <marlonbasta at gmail.com> wrote:
>>
>> Ok.
>>
>> I find the example below:
>>
>> i, o, e = client.exec_command('cd /etc')
>>
>> i.write('ls\n')
>> i.flush()
>>
>> I test it, but don't work.
>> Waht do you think about it?
>>
>
> It won't work, because there's no shell running on the other end to
> interpret the second command. You would need to use something like
> client.exec_command('ls /etc')
> or,
> client.exec_command('cd /etc; ls')
In Linux, there are few commands that have an option to change working
directory. For example "tar" has "--directory" option that will change
pwd for that process. May be you the commands you need to use have
such option too.
Another valid option could be to generate a shell script, upload it to
a temporal directory and execute it.
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
More information about the paramiko
mailing list