Script to SSH into a server

Hi,
Actually i'm trying to write a script which needs to ssh into a server and run a command on the server, after entering a valid login.

But after ssh the script will no longer run on the SSHed server :frowning:

so is there any way to do so ???

A remote script that has a

chmod 0000 `basename $0`

in it's body.

Might also need an "export HOME=/root" statement (if run as root, or other acceptable user.)

HTH