I have a case where I need a applescript on my computer to be able to be launched, and that will telnet to a XServe and run a shell script to reindex a intranet site on the XServe. Everything is in place and works fine, except, supplying the login name and password. I know this is a frowned on practice, I will be the only one using it. Here is a sample of the login script I’m using.
tell application "Terminal"
activate
do script "telnet 192.168.100.243"
end tell
This works part works, but how do I supply the Name and Pword? Any help is much appreciated.
You can log in automatically and start a command with ssh (or the older rsh, but the server for that may not be running on your XServe).
do shell script "ssh ashley@gem ls"
logs into a Solaris UNIX machine we have and runs ls to list files.
I don’t have to type a password as I’ve set up ssh public/private keys. (There are various other ways to get this kind of remote command invocation to work without having to type a password, including the “old fashioned” .rhosts and hosts.equiv ways, but I don’t know if these will work on a modern OS X server). http://www.hklc.com/infocenter/1115.html gives some instructions for setting up ssh keys. The instructions look a little cryptic but are probably correct.