By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,100 Members | 2,979 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,100 IT Pros & Developers. It's quick & easy.

Paramiko and ftp upload

P: 2
I am fairly new to python, so this might be a trivial problem.

I am using paramiko module to log in to ssh server running CentOS. I would like my program to upload some files from that ssh server to a remote ftp server. The problem is, that whenver I use exec_command to run ftp client, it closes immediately. Is there any other way of doing that? I don't really need to use the paramiko module, I can use anything, as long as it gets the job done.

Thank you in advance for any help!
Dec 22 '10 #1
Share this Question
Share on Google+
3 Replies


Expert 100+
P: 624
Try subprocess.Popen with shell=True http://www.doughellmann.com/PyMOTW/s...ule-subprocess. If you still have problems, capture the output pipe (also explained at the same site = "Working with Pipes Directly") and check for any error messages.
Dec 22 '10 #2

P: 2
The problem is, that I'm running the program on Windows. There is no native SSH client that I could use with subprocess.
Dec 22 '10 #3

Expert 100+
P: 624
Putty is the only program that I am aware of. You will probably want PuTTY, PuTTYgen, Pageant, and Plink from http://www.chiark.greenend.org.uk/~s.../download.html, and the docs http://the.earth.li/~sgtatham/putty/0.60/htmldoc/. The simple example is
c:\plink username@1111.222.0.1 -pw <password> <command to be executed in server>
Running this from subprocess.Popen will allow you to fetch the output if you want. There is pexpect as well (an example, and keyphrene, but I have not tried either.
Dec 22 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.