ssh/unix help?

Im trying to ssh into a machine via a script but im getting a error all the time?!?!

Any unix buff’s in here that can help?

do shell script "ssh username@12345.local"

the error i get is this;

“Pseudo-terminal will not be allocated because stdin is not a terminal.
Permission denied, please try again.
Permission denied, please try again.
Permission denied (gssapi-with-mic,publickey,gssapi,password,keyboard-interactive).”

Ive tried anding -t and -T but without any luck

I can ssh into this machine via terminal but not via this script,

any ideas?

I don’t understand why you thought this simple script might work. SSH is interactive. How was your script going to accomplish that? I think you’ll have to script the Terminal to get what you want.

Something like this then…

tell application "Finder" to activate application "Terminal"
delay 0.5
tell application "System Events" to keystroke "ssh username@12345.local"
tell application "System Events" to keystroke return

How about actually scripting Terminal?

tell application "Terminal"
	do script "ssh username@12345.local"
	delay 2
	do script "pwd" in window 1
end tell

Well you can make that shorter, but that’s the idea - it will get you into the Terminal window.

activate application "Terminal"
repeat until window 1 of application "Terminal" exists
	delay 0.5
end repeat
tell application "System Events" to tell process "Terminal" to keystroke "ssh username@12345.local" & return

If Terminal is already running but has no open windows, then you’re going to be waiting a while. :wink: (You’ll also get unintended behavior if window 1 isn’t a shell.)

Since he can’t really set up an interactive SSH session effectively, the whole exercise is moot. True, though, that the script supposes that the Terminal is not running. If it is, we need a new window and checks for it, etc. - your solution is the way to go.