title: ssh using python without RSA keys
body: <p>New to Stackoverflow, so first off, hello.</p>
  
  <p>I'm working on a little project for my school which is supposed to be a custom gui (written in python as an educational challenge for me since I've never used python) for the open source Unison program. We're trying to allow students and staff to sync a folder at home and the school by launching this program with as little input as possible (idiot-proofing if you will). The interface is supposed to be just they're school username and password and the gui wrapper should just send the username and password to Unison and sync them. </p>
  
  <p>The problem is Unison in turn launches SSh and prompts for the password but python subprocess.communicate(input) method won't let ssh take the password. I realized ssh will only accept input from the terminal and I can't figure out how to trick it. I've read some stuff about using a pseudo terminal but I'm still stumped. RSA keys would be the ideal solution, but generating them and then placing them on the remote server still involves me needing to login with a password at least once and that would require a solution to the above, or the terminal which is not idiot proof. </p>
  
  <pre><code>def startSync(self):
      '''
      '''
      userName = self.userNameIn.get()
      userPass = self.userPassIn.get()
      localDir = "/Users/localuser/syncFolder/"
      remoteDir = " ssh://schoolServer/remotesyncFolder" #for testing purposes, I set this to my own home machine which logs into my own account if I don't provide me@myserver.net
      unisonExecRemotePath = " -servercmd /Users/RemoteMe/unison" #unison is the unix executable responsible for launching unison on the remote system
      silenceCmdPrompts = " -silent" #keeps unison from displaying directory differences and asking if its okay to sync
      executionString = "./unison" + localDir + remoteDir + unisonExecRemotePath + silenceCmdPrompts
  
     mainProcess = subprocess.Popen(executionString,shell = True, stdin = subprocess.PIPE)
     mainProcess.communicate(userPass)
  </code></pre>
  
  <p>The execution strings works fine in there terminal if I paste it in. And any general python tips would also be appreciated if you're so inclined. </p>
  
  <p>Thanks!</p>
  
  <p>Unison User Manual: <a href="http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html" rel="nofollow">http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html</a></p>
  
  <p>Edit: I should also note that while I'm currently developing under OSX and Linux, I will eventually have to make this windows compatible since most of my school's students run windows  as their primary (or only) machine. </p>