New to Stackoverflow, so hello first.
I am working on a small project for my school, which is supposed to be a regular gui (written in python as an educational challenge for me since I never used python) for an open source Unison program. We are trying to allow students and staff to synchronize the folder at home and school by running this program at the lowest cost (idiot protection, if you want). It is assumed that the interface is just the username and password for the school, and the gui shell should just send the username and password to Unison and synchronize them.
The problem is that Unison, in turn, starts SSh and asks for a password, but the python subprocess.communicate (input) method will not allow ssh to take the password. I realized that ssh will only accept input from the terminal, and I cannot figure out how to trick it. I read some things about using a pseudo terminal, but I'm still at a dead end. RSA keys would be an ideal solution, but generating them and then placing them on a remote server still makes me log in with the password at least once, and this will require the solution above, or a terminal that is not idiotic proof.
def startSync(self):
'''
'''
userName = self.userNameIn.get()
userPass = self.userPassIn.get()
localDir = "/Users/localuser/syncFolder/"
remoteDir = " ssh://schoolServer/remotesyncFolder"
unisonExecRemotePath = " -servercmd /Users/RemoteMe/unison"
silenceCmdPrompts = " -silent"
executionString = "./unison" + localDir + remoteDir + unisonExecRemotePath + silenceCmdPrompts
mainProcess = subprocess.Popen(executionString,shell = True, stdin = subprocess.PIPE)
mainProcess.communicate(userPass)
Execution lines work fine in the terminal if I insert it. And any general python tips would also be appreciated if you are so addicted.
Thank!
Unison: http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html
: , , OSX Linux, , Windows ( ) .