• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Pseudo-tty as piped to NSTask -- help?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pseudo-tty as piped to NSTask -- help?


  • Subject: Re: Pseudo-tty as piped to NSTask -- help?
  • From: Kyle Moffett <email@hidden>
  • Date: Fri, 12 Sep 2003 19:50:47 -0400

On Thursday, Sep 11, 2003, at 17:46 US/Eastern, Fritz Anderson wrote:
openpty() succeeds. I create an NSFileHandle from the slave descriptor. I pass the slave NSFileHandle in both the setStandardInput: and setStandardOutput: messages while setting up the ssh NSTask. My app does I/O on the NSFileHandle built on the master descriptor, and in fact characters sent in the master end get echoed back.

MY PROBLEM: What I don't see is the ssh tool recognizing what I've provided, as a tty device. The password prompt is not sent, the tool does not pause for a password to be entered, and the password I send blindly to the tool is not used.

The issue is probably that the ssh tool clears its standard input before reading the password, to help the user against accidentally typing something before the password prompt comes up. Try waiting for the string "user@host's password:" (NOTE: There is no newline after it), sleeping for a second (Just to make sure), then sending the password. Otherwise it will probably be cleared in the fflush(stdin); that ssh does before reading passwords. A simpler method might be to look up information on public key authentication (SEE: man pages for ssh and ssh-keygen and Google for more info)

I am terribly naive on UNIX issues, and so I am probably missing something obvious. Could someone set me straight?

I have had this problem before. Just make sure you wait for it to completely get ready for the password prompt.

(Would it matter -- I think it should not -- that I did not specify terminal type or geometry in the openpty() call?)

Don't think so. On the other hand, what programs are you running on the remote end? If you are recieving anything other than straight ASCII, then things probably won't work as you expect. You might tell ssh not to create a pty and to ignore escape characters on the remote end with "-e none -T".

HTH,
Kyle Moffett
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Pseudo-tty as piped to NSTask -- help? (From: Fritz Anderson <email@hidden>)

  • Prev by Date: Re: splash screen
  • Next by Date: Re: Country code or name
  • Previous by thread: Re: Pseudo-tty as piped to NSTask -- help?
  • Next by thread: Default app for doc type problem
  • Index(es):
    • Date
    • Thread