| MacTalk Forums |
| Mac OS X Discussion and support on Mac OS X. If you have an issue with an application (e.g: Safari, or iPhoto, or Adium), it goes in the Applications forum. |
| Reply |
|
|
LinkBack | Thread Tools | Display Modes |
| MacTalk Forums |
| Mac OS X Discussion and support on Mac OS X. If you have an issue with an application (e.g: Safari, or iPhoto, or Adium), it goes in the Applications forum. |
| Reply |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
Ok, long story short, there is a bit of a friendly war going on between my friend and myself... Various things have been done to each others computers; nothing harmful.
My mission (that I came up with) is to remotely control his computer via Terminal and SSH to do the following...
The reason for SSH. He doesn't know about it. It doesn't show up anywhere that I'm connecting with it, and I can control my scripts with PHP using it's exec() functions. So, here's where I'm stuck... I can log into SSH through terminal, and can run commands one by one, but this way, I have to type them in when I want to run them. What I would like to do, is have a single one-liner that I can execute. If it will work through terminal, I can get it to work with PHP. This command needs to log in with SSH (with a password), then allow me to run a series of commands after it. Only ever 2 or 3 at max (eg: volume up, play song; or; volume up, say "hello", volume down). If I can get this to work, he wont know what hit him... and it should teach him not to touch my computer when I'm not around... Anyone got any ideas?
__________________
i3network.net | Email/AIM: adamd(at)i3network.net | msn: i3network(at)hotmail.com | Follow me on TUMBLR my tech collection stalk me on the interwebs. |
|
||||
|
<< No expert:
You need to have the script on his system in his profile to be really effective. Is this going to be done over the net or locally - on a network? Do you know his username / password? Perhaps, and don't take this wrong, you should maybe learn to lock your computer when you leave it. That's one that most reputable employers would rather their staff had.
__________________
iPhone & iPhone 3GS, Macbook Pro 17" C2D 2.8ghz. iMac alu. 20" C2D 2ghz. iMac 20" CD 2ghz & Cube 450mhz. Website |
|
||||
|
This will be done locally, over a network. I already have an admin account on his computer, with a password that I know.
By script, you mean batch script?
__________________
i3network.net | Email/AIM: adamd(at)i3network.net | msn: i3network(at)hotmail.com | Follow me on TUMBLR my tech collection stalk me on the interwebs. |
|
||||
|
Personally? I'd use an applescript. I don't know if it's possible to have an applescript sit in the background and wait for a rule to happen... but if it is then it would surely be better to have it activate whenever he types www or th then perform an action (use speech to say "I'm looking at pr0n") for example.
__________________
iPhone & iPhone 3GS, Macbook Pro 17" C2D 2.8ghz. iMac alu. 20" C2D 2ghz. iMac 20" CD 2ghz & Cube 450mhz. Website |
|
|
|||
|
Rather than typing in a password I think you'd be better off setting up an SSH key to handle authentication as it'll make automation a lot easier. Google will find a stack of guides to get you going with that.
Command execution can be done a number of ways. PHP is not one I'd consider because I find PHP clumsy as a general purpose scripting language. The simplest thing you could do that (once you have keys in place), it just to send a series of commands when you invoke SSH, eg: Code:
ssh -l username hostname.local. "say Hello ; sleep 2; say oi!" Code:
say Hello sleep 2 say oi Code:
ssh -l username hostname.local -p 22 "`cat /pathto/textfilename`" |
|
|
||||
|
You need to setup a certificate/key on the target machine so that it authenticates you without requiring a password.
For an example of how to set this up have a look at this: SSH login without password That way you can send shell commands via SSH. I use this to do remote SCP backups via shell scripts. Very easy once you get it going. |
| Reply |
| Bookmarks |
| Tags |
| control, remote, ssh, terminal |
| Thread Tools | |
| Display Modes | |
|
|