Multi-line terminal commands

Reply

Join Date: May 2007
Posts: 2
Reputation: time4biking is an unknown quantity at this point 
Solved Threads: 0
time4biking time4biking is offline Offline
Newbie Poster

Multi-line terminal commands

 
0
  #1
May 23rd, 2007
I am writing a program to ssh into another computer on our network. However with the commands ssh, scp etc... terminal requests the password and os.system() seems to open a new terminal window each time it is called. This makes it difficult to enter the password.

I have been looking at os.system(), popen() and appscript's app(u'/Applications/Utilities/Terminal').do_script().

Any help would be greatly appreciated.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 2
Reputation: LouLouLou is an unknown quantity at this point 
Solved Threads: 1
LouLouLou LouLouLou is offline Offline
Newbie Poster

Re: Multi-line terminal commands

 
0
  #2
May 24th, 2007
have you tried with the FTP facilities ?

18.8 ftplib -- FTP protocol client
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 146
Reputation: G-Do is an unknown quantity at this point 
Solved Threads: 28
G-Do's Avatar
G-Do G-Do is offline Offline
Junior Poster

Re: Multi-line terminal commands

 
0
  #3
May 24th, 2007
Remotely connecting to other systems by invoking external bash commands is cumbersome, isn't it? You'd be better served by learning how to use the paramiko package, which lets you do the same thing but from within Python:

http://www.lag.net/paramiko

Check out the instructions that come with the package for short demos on how to connect to remote systems. I use it at work, and it wasn't too much hassle to set up and use.

There are ways of doing this with os.popen(), if you're dead set on doing things that way - you can use "here documents" to enter the password and commands, I believe - but I haven't actually tried that on my own, so don't hold me to it.

Hope that helps.
Vi veri veniversum vivus vici
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 2
Reputation: time4biking is an unknown quantity at this point 
Solved Threads: 0
time4biking time4biking is offline Offline
Newbie Poster

Re: Multi-line terminal commands

 
0
  #4
May 25th, 2007
paramiko seems to be just the ticket. Thanks!
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 311
Reputation: BearofNH is on a distinguished road 
Solved Threads: 40
BearofNH's Avatar
BearofNH BearofNH is offline Offline
Posting Whiz

Re: Multi-line terminal commands

 
0
  #5
May 29th, 2007
I've successfully used telnetlib (included in Python, I believe) in similar cases. Telnet is a more primitive remote-terminal protocol which suffers from a number of security issues, one reason why SSH was developed. If you can use paramiko then by all means do so. But if you run into problems with it, consider telnetlib. In my case security is not an issue due to physical isolation.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Python Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC