Remotely launching an application

jove

Member
Hello,

I would like to remotely launch an application. Applescript does not seem to have the ability to do this. SSH has the ability (turn rlogin on in the sharing prefs).

SSH hostname
login
open "/Applications/iTunes.app"
exit

Being able to wrap that transaction into a single Applescript string would be great.

do shell script "..."

My laptop would then be able to select a "Get Remote Music" script from the iTunes script menu. The remote computer is our music server.

Any ideas?
 
Couldn't you just do this?
do shell script "SSH hostname; login; open "/Applications/iTunes.app"; exit"

I'm not sure if that'd work, I haven't tried it. But that just basically wraps your terminal commands in a do shell script.
 
From command line

ssh -l jove 192.168.1.52 'open /Applications/iTunes.app'

asks for a password and works

From Applescript

do shell script "ssh -l jove 192.168.1.52 'open /Applications/iTunes.app'"

gives the following error

Permission Denied, please try again.
(publickey,password,keyboard-interactive

The man pages talks about files with authentication keys. I got lost!
 
The following will allow passwordless ssh sessions. When it asks for a passkey, just press return.

clientbox$ ssh-keygen -t rsa
serverbox$ mkdir ~/.ssh
clientbox$ scp .ssh/id_rsa.pub user@ serverbox.domain.com:~/.ssh/
clientbox$ ssh user@serverbox.domain.com
serverbox$ cd ~/.ssh
serverbox$ cat id_rsa.pub >> authorized_keys2
serverbox$ chmod go-w authorized_keys2
 
On the other hand, if you'd rather NOT open up your SSH port to any passing script kiddie, you could just write your script to include the password.

ssh username:password@hostname

(edited to remove smiley error)
 
The syntax you provided asks for the password of 'username:password'. Reentering the password does not work.

I am not too worried about script kiddies. I am behind a hardware router. When they pass, they'll see Apache, that's it.
 
Back
Top