Capture the command promp response??

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • crossdelena
    New Member
    • Feb 2008
    • 3

    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
  • python1
    New Member
    • Feb 2008
    • 3

    #2
    Originally posted by crossdelena
    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
    Last edited by python1; Feb 21 '08, 08:21 AM. Reason: Link added

    Comment

    • crossdelena
      New Member
      • Feb 2008
      • 3

      #3
      Originally posted by python1
      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

      Comment

      • crossdelena
        New Member
        • Feb 2008
        • 3

        #4
        Originally posted by crossdelena
        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

        Comment

        Working...