Go Back   The macosxhints Forums > OS X Help Requests > Applications



Reply
 
Thread Tools Rate Thread Display Modes
Old 09-27-2004, 11:00 AM   #1
AHunter3
Hall of Famer
 
Join Date: Jan 2002
Location: New York City
Posts: 3,003
AppleScripting Terminal to SSH: the bloody password

The only AppleScript routine I have at my fingertips for having an AppleScript-capable application cause Terminal to make an SSH connection to our server is using

Code:
 do script "ssh 192.168.xx.yyy" in Window 1
wait 4
 do script "thePassword" in Window 1
which works except that sometimes on our oft-sludgy network the Terminal hasn't succeeded in knocking on Server's door and getting the "Password?" prompt by the time the next AppleScript line executes, and when that happens the Server's password appears in the Terminal window, visible to the user and plain as daylight.

Under MacOS 9, where I'm doing it via the program MacSSH PPC, I create the connection via AppleScript step 'getURL ssh UserName:thePassword@192.168.xx.yy' and no matter what happens the password never appears in plain text in the window.

I've tried 'do script ssh UserName:thePassword@192.168.xx.yy' under OS X but that doesn't fly.

Advice? Is there some way I can turn 'echo off' until I've made a connection, maybe?
AHunter3 is offline   Reply With Quote
Old 09-27-2004, 11:04 AM   #2
vancenase
All Star
 
Join Date: Apr 2003
Location: OH
Posts: 934
one possibility: setup passwordless SSH.

http://bumblebee.lcs.mit.edu/ssh2/
vancenase is offline   Reply With Quote
Old 09-27-2004, 01:14 PM   #3
AHunter3
Hall of Famer
 
Join Date: Jan 2002
Location: New York City
Posts: 3,003
Wouldn't the tendency/ability of people to see the key being sent = an ability to establish the same connection manually sending the same lines they say onscreen?
AHunter3 is offline   Reply With Quote
Old 09-27-2004, 05:14 PM   #4
AHunter3
Hall of Famer
 
Join Date: Jan 2002
Location: New York City
Posts: 3,003
Never mind. When all else fails, try the obvious and have the Mac do what you'd do yourself —

If contents of window 1 contains "password" then
{do script "thePassword" and then do other stuff}
else
display dialog "Connection failed" buttons ["damn"]
End If
AHunter3 is offline   Reply With Quote
Old 09-27-2004, 05:50 PM   #5
Las_Vegas
League Commissioner
 
Join Date: Sep 2004
Location: Las Vegas
Posts: 5,875
You might want to place the test into a wait loop to exit when the word 'password' appears or it times out.
__________________
Las_Vegas

-- Ts'i mahnu uterna ot twan ot geifur hingts uto.
-- Sometimes I wonder… Why is that Frisbee getting Larger? …and then it hits me.
-- Disposable thumbs make me specialer than most animals…
Las_Vegas is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 06:26 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.