473,385 Members | 1,154 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Capture the command promp response??

Hi,

I am trying to write a python script which will enable me to login into a remote system and perform some actions.

However, when I run ssh through python, it asks me for a password.
I know I can create a password encryption key which will enable me to log in without any prompt for password.

But can someone explain me how can I capture the command prompting for a password and provide a password using python??

Thanks,

Cross
Feb 15 '08 #1
3 2154
Hi,

I am trying to write a python script which will enable me to login into a remote system and perform some actions.

However, when I run ssh through python, it asks me for a password.
I know I can create a password encryption key which will enable me to log in without any prompt for password.

But can someone explain me how can I capture the command prompting for a password and provide a password using python??

Thanks,

Cross

You can download the 'pexpect' module. It is a simple python script which will help you execute commands on a Linux machine. For more information : http://pexpect.sourceforge.net/pexpect.html
Feb 21 '08 #2
You can download the 'pexpect' module. It is a simple python script which will help you execute commands on a Linux machine. For more information : http://pexpect.sourceforge.net/pexpect.html

Thanks...I will digg into it!!

But one question is do I need to install this module separately cause if yes then I will loose the portability of my code??

-Cross
Feb 22 '08 #3
Thanks...I will digg into it!!

But one question is do I need to install this module separately cause if yes then I will loose the portability of my code??

-Cross

Hi,

I have worked out a way of connecting to a system through SSH using pexpect module. However, now I am looking into establishing a consistent connection in order to execute few commands.

Can anyone help me out??

-Cross
Mar 3 '08 #4

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

Similar topics

9
by: Jay Donnell | last post by:
I have a function that is a few thousand lines of code (I didn't write it) and I want to capture the output and save it as a variable. This is very easy to do in php. It would look something like...
0
by: Mark Barinstein | last post by:
Hello. W2K, db2 v7, FP10a. Before now our replication worked properly. But some days ago capture suddenly stopped loggin and filling cd tables without any messages. The last message was like...
5
by: TerryWilson | last post by:
I am developing a web based service tool using asp.net that we will distribute with our product. This service tool will be used for remotely configuring the product, problem determination, etc. ...
4
by: Bill Manring | last post by:
I need to capture the event when the user closes the browser in my application. I have some code in the session_End event, which works fine when the session times out, but I need to end the...
34
by: Roman Mashak | last post by:
Hello, All! I'm implementing simple CLI (flat model, no tree-style menu etc.). Command line looks like this: <command> <param1> <param2> ... <paramN> (where N=1..4) And idea is pretty simple: ...
0
by: j101 | last post by:
I am attempting to set up Q Capture on RH Linux (x86_64) using DB2 9 fp2, but there seems to be a general problem loading a specify MQ shared library "/opt/mqm/lib/libmqm_r.so". I have MQ v6...
1
by: sangith | last post by:
Hi, I tried the packet capture module program. I did a file transfer using ftp from this host to another server. But when I ran the program, it was just hanging off and it did not print the...
10
by: lalnamar | last post by:
I want to execute a unix time command using perl, and capture the output (specifically, the time it takes the command to execute). i tried using the system command: system("time command ");...
2
by: jdbartlett | last post by:
I'm trying to capture output from a command line utility (XMLSec), but only get an empty result. If I call the script from the command line, I see XMLSec's output, but I can't seem to capture it!...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.