Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I made a script recently and have turned it into an app, it basicly logs me into my vps via ssh but I don't know how to tell it how to type in my password for me, heres the code

 tell application "Terminal"
    activate
    do script "ssh root@example.com"
end tell
share|improve this question
1  
Use passwordless authentication: debian-administration.org/articles/152 –  Gerry Jan 22 '13 at 17:52
    
it didn't work, I probably messed up –  surferconor425 Jan 22 '13 at 18:11
    
@surferconor425 It's not that hard to fix, might be a better route to take. I also got it wrong the first few times but it is actually quite easy to get up and running. –  Diago Jan 22 '13 at 19:01

1 Answer 1

What you want is pretty bad. You should never have a password written in a file. But here is the solution you asked.

tell application "Terminal"
    activate
    do script "ssh root@example.com"
    delay 1
    tell application "System Events"
        keystroke "yourPasswordHere"
        keystroke return
    end tell
end tell
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.