Re: Remoting over SSH
Lucas Carvalho wrote: Hussein B wrote: Hey, I want to perform commands on a remote server over SSH. What do I need? Thanks. Hi, If you want to use the SSH2 protocol into a python code, you should take a look at this module: paramiko [1]. [1] http://www.lag.net/paramiko/ If you're looking for remote Python execution over SSH have a look at http://codespeak.net/py/dist/execnet.html -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Jul 10 2009) Python/Zope Consulting and Support ...http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/ ::: Try our new mxODBC.Connect Python Database Interface for free ! eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Remoting over SSH
Hussein B wrote: Hey, I want to perform commands on a remote server over SSH. What do I need? Thanks. Hi, If you want to use the SSH2 protocol into a python code, you should take a look at this module: paramiko [1]. [1] http://www.lag.net/paramiko/ Regards, Lucas. -- http://mail.python.org/mailman/listinfo/python-list
Re: Remoting over SSH
Hussein B hubaghd...@gmail.com wrote: Hey, I want to perform commands on a remote server over SSH. What do I need? Thanks. Access privileges for the remote machine. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list
Re: Remoting over SSH
Hello! I wrote a litle program that send commands to many cluster nodes: #!/usr/bin/env python #By: Djames Suhanko #servers list sincroniza =[server1.domain,server2.domain, server3.domain] import pexpect import sys from threading import Thread #the user and pass can be in ini file. #Test parameters list try: if sys.argv[3]: pass except: print Use: + script + command user pass sys.exit() #This function send the command in argument def executor(command,username,password,server): a = 'ssh ' + username + '@' + server foo = pexpect.spawn(a) foo.expect('.*ssword:') foo.sendline(password) foo.sendline('su') foo.expect('.*sword:') foo.sendline('root_password_here') foo.sendline(command + ' exit') print command to: + server + ..[OK] foo.sendline('exit') foo.expect('.*osed.') foo.interact() #make a list tasks = [] #theading loop for i in sincroniza: t = Thread(target=executor,args=(sys.argv[1],sys.argv[2],sys.argv[3],i)) t.start() tasks.append(t) #wait the end for t in tasks: t.join() it's all! On Wed, Jul 8, 2009 at 9:15 AM, Hendrik van Rooyenm...@microcorp.co.za wrote: Hussein B hubaghd...@gmail.com wrote: Hey, I want to perform commands on a remote server over SSH. What do I need? Thanks. Access privileges for the remote machine. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list -- Djames Suhanko LinuxUser 158.760 -- http://mail.python.org/mailman/listinfo/python-list
Re: Remoting over SSH
You also could use TwistedConchhttp://twistedmatrix.com/trac/wiki/TwistedConch, which is an implementation of the SSH2 protocol for Python. I've done something with it, you can read my first questions on the TwistedConch list herehttp://twistedmatrix.com/pipermail/twisted-python/2007-October/016121.html . Hope that helps... -- Nacho Linux Counter #156439 -- http://mail.python.org/mailman/listinfo/python-list
Re: Remoting over SSH
On Jul 8, 12:46 am, Hussein B hubaghd...@gmail.com wrote: I want to perform commands on a remote server over SSH. What do I need? Take a look at pexpect: http://pexpect.sourceforge.net/pexpect.html -- http://mail.python.org/mailman/listinfo/python-list
Re: Remoting over SSH
On 2009-07-07, Hussein B hubaghd...@gmail.com wrote: I want to perform commands on a remote server over SSH. What do I need? catb.org/esr/faqs/smart-questions.html There are many ways to remote using ssh. If we know what you are trying to do, maybe we could give you a better answer. If you just want to open the python interpreter interactively on another host you can do something like: ssh -t u...@host python That will allow you send commands to the python interpeter. You could write a script and pipe it into the interpreter: cat script.py | ssh -t u...@host python Maybe you want to open an ssh connection and send shell commands from a python script. You can do that using one of the popen2 functions: http://docs.python.org/library/popen2.html -- http://mail.python.org/mailman/listinfo/python-list