Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7938573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:50:52+00:00 2026-06-03T22:50:52+00:00

New to Stackoverflow, so first off, hello. I’m working on a little project for

  • 0

New to Stackoverflow, so first off, hello.

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.

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.

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)

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.

Thanks!

Unison User Manual: http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T22:50:53+00:00Added an answer on June 3, 2026 at 10:50 pm

    Look into pexpect.

    import pexpect
    
    child = pexpect.spawn('ssh myname@host.example.com')
    child.expect('Password:')
    child.sendline(mypassword)
    child.interact()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

New to StackOverflow here. I'm working on the first Euler problem and have run
I'm playing a little bit with the new StackOverflow API . Unfortunately, my JSON
Hello StackOverflow Users, I am new to android and trying to develop a game
I am new to Python and this is my first time asking a stackOverflow
I'm new to ruby and this is my first stackoverflow question (although I've used
Brand new to coding; been utilizing stackoverflow religiously for months; first time asking a
This is my first question here on StackOverflow, and quite frankly I'm fairly new
i m new to stackoverflow and this is my first question. My question is
I'm quite new to stackoverflow and this is my first question. I am trying
First off, I am VERY new to Java, but wanted to know if it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.