Running a bash script
dom at happygiraffe.net
Wed May 22 12:38:39 BST 2002
On Wed, May 22, 2002 at 11:53:48AM +0100, Roger McCalman wrote:
> On Wed, May 22, 2002 at 11:48:30AM +0100, Mark Stewart wrote:
> > Hi all,
> > What I want to do:
> > Run a shell script on my windows pc to connect passwordless via ssh2 to a FreeBSD 4.x PC (I can already do) run a shell script then the bash shell window to close.
> By using ~/.ssh/authorised_keys and ssh-keygen you can create public/private keys
> to allow passwordless login.
Usefully, putty allows you to use keys on windows easily. It also
comes with plink, a tool that runs from the command line. As well, it
has pageant, an ssh-agent like tool, so you don't have to be prompted
for the keyphrase each time. It's really very nifty indeed.
Alternatively, you could use a key without a pass phrase, but which is
only able to run the specific script you want. This is a useful and
under-used feature of ssh. Search for "command=" in the sshd man page.
> > I was wondering how I would do this on the FreeBSD - can I pass ssh a path of a shell script to run.
> ssh freebsd-host 'shell command line'
> the sheel command line would probably want to use nohup and have a & to background
> the process so that the ssh can complete.
> I have never used ssh on windows but it works well from unix to unix.
If you don't use the nohup/& the ssh will wait for the command to
finish, then close the window. This may be acceptable for you.
More information about the Ukfreebsd