Paramiko and ftp upload

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mateusz Dudek
    New Member
    • Dec 2010
    • 2

    Paramiko and ftp upload

    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!
  • dwblas
    Recognized Expert Contributor
    • May 2008
    • 626

    #2
    Try subprocess.Pope n 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.

    Comment

    • Mateusz Dudek
      New Member
      • Dec 2010
      • 2

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

      Comment

      • dwblas
        Recognized Expert Contributor
        • May 2008
        • 626

        #4
        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.2 22.0.1 -pw <password> <command to be executed in server>
        Running this from subprocess.Pope n 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.

        Comment

        Working...