title: installing software on remote machine via python script
body: <p>this is for work... so i will share as much as i can, I'm trying to install "environment" on a remote machine via python script, this "environment" require to pass to it user name and password, I tried a lot of things, nothing seems to work... the closest thing is this script, yet after it passes the user name a GUI popup and ask for the password... what i'm doing wrong ?! or what can i do to make it work?!... here is a part of the script that deal with pexpect</p>
  
  <pre><code>import os
  import pexpect
  
  cmd = 'ssh -X groupName@machineName cd ~/theLocationOfTheInstallation/ &amp;&amp; pwd &amp;&amp; theFullPathOfTheFileToInstall'
  child = pexpect.spawn(cmd)
  cmd_show_data = ''
  usr = 'userName'
  pas = 'myPassword'
  while not child.eof() :
      index = child.expect(['Please enter your.*','pass.*', pexpect.EOF, pexpect.TIMEOUT])
      cmd_show_data += child.before
      child.delaybeforesend = 1
      if index == 0 :
          print 'user name required, "'+usr+'" is passed'
          child.sendline(usr)
      elif index == 1 :
          print 'password required, "'+pas+'" is passed'
          child.sendline(pas)
      elif index == 2 :
          print 'EOF'
      elif index == 3 :
          print 'TIMEOUT'
  cmd_show_data += child.before
  cmd_show_data  = cmd_show_data.split('\r\n')
  for s in cmd_show_data :
      print s
  </code></pre>
  
  <p>this is the GUI that popup :
  <a href="https://i.stack.imgur.com/w4gcW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/w4gcW.png" alt="enter image description here"></a>
  if i enter the password manually (which i'm trying to avoid), i get output like this :</p>
  
  <pre><code>user name required, "userName" is passed
  TIMEOUT
  TIMEOUT (a lot of times out)
  user name required, "userName" is passed
  TIMEOUT
  TIMEOUT (a lot of times out)
  password required, "myPassword" is passed
  TIMEOUT
  TIMEOUT (a lot of times out).... till the installation is complete.
  </code></pre>
  
  <p>so.. any ideas?</p>