Hello, everyone. This is my first post here and I’m fairly new to AppleScript as a whole. What I’m trying to do is open an SSH session with a remote Mac in order to run some code. I am running into an issue via (do shell script) that’s otherwise, not really an issue via Terminal activation. The issue is regarding the password prompt for the SSH session. I get this error :
Because it repeats three times, I’m thinking it’s result of failed password attempts, but I’m not sure what my script is trying to put in there. Here is the SSH portion of my AppleScript :
# Gather SSH Credentials
if the button returned of Dialog_2 is "Continue" then
set AdminName to ""
set Dialog_4 to display dialog "Admin name:" default answer ""
set AdminName to text returned of Dialog_4
set PassKey to ""
set Dialog_5 to display dialog "Admin Password:" default answer "" with hidden answer
set PassKey to text returned of Dialog_5
end if
# Open SSH Session
set ssh to (do shell script "ssh " & AdminName & "@" & HostName & "mydomain.com")
try
if ssh contains "yes/no" then
(do shell script "yes")
else
(do shell script PassKey)
end if
end try
Any help here would be greatly appreciated. Thank you!
ALSO : I can’t use a key and I don’t want to use expect. I can get this to work if I call Terminal, but not in the AppleScript shell.
Model: 15" Retina MacBook Pro
AppleScript: 2.2.4
Browser: Safari 537.36
Operating System: Mac OS X (10.8)