On 7/23/05, 刚 王 <[EMAIL PROTECTED]> wrote: > I would like to write a Python code like this: > > It can login a host by SSH > after login the host, use SCP to get a remote file, so it can deliver file > to the host. > then execute the program > then leave the host > > For example : > > STEP 1. ssh xxxx_yyy at 123.45.67.89 > STEP 2. Enter the password automatically > STEP 3. run " scp -r zzz at 123.45.67.90:/home/xxx/program ." > STEP 4. Enter the password for SCP automatically > STEP 5. run "./program" > STEP 6. run " exit" > > I know telnetlib can help us with telnet, and how to deal with this SSH > situation in Python? > > Thanks a lot for your help :) >
I would recommend looking at the following utilities: http://www.theether.org/pssh/ http://sourceforge.net/projects/pyssh Setting up private/public key authentication is going to allow for a greate amount of secure automation. Barring that, use the pexpect module to do the prompt handling. -jesse
-- http://mail.python.org/mailman/listinfo/python-list