ssh script



I am trying to set up a script to to ssh into another machine and
perform some commands. I have managed to create the keygen and
transfer it accross so that I can ssh without being prompted for a
password. However each time I execute the script I only make it as far
as logging into the remote machine. A basic testscript I have tried is
the following.

#!/bin/Bash
ssh user@remote_machine
touch testfile
exit

Once I can perform this basic command then I can work on exactly what
I want the script to do. Unfortunately I cannot execute the touch or
exit command. I have tried using the wait command in between ssh and
touch but to no avail. Can somebody please help or point me in the
right direction.
.



Relevant Pages

  • Scripts using SSH and SSH_ASKPASS
    ... To test SSH scripts you better destroy the control TTY. ... The trick is to run YOUR script on YOUR local ... As for the password relaying command: this needs not be an X command. ... # we read one line from a temporary pipe. ...
    (comp.security.ssh)
  • Re: remote server backup script
    ... > Just type away at the command line. ... Make a backup of whatever you want ... > command line, in a script. ... >>the server ssh key on the clients machine). ...
    (comp.os.linux.misc)
  • Re: [PHP] SSH and php
    ... % % Is it possible to run a SSH command from php? ... it's possible to run any command from php. ... There are ways to do that -- I personally would create a kick script ...
    (php.general)
  • RE: Execute script on remote computer
    ... Execute script on remote computer ... you should just use the ssh command coupled with the name of the ...
    (comp.lang.python)
  • Using SSH to terminate remote systems for disaster recovery
    ... I have a need to terminate a number of AIX 5.1 systems ... from a single script. ... I can do this using ssh. ... if I issue the shutdown command from ssh, ...
    (AIX-L)