Re: [SLUG] Remote Execution

From: Kwan Lowe (kwan@digitalhermit.com)
Date: Fri Nov 14 2003 - 10:21:31 EST


>
> I have two linux servers and I would like to execute some routine
> programs on one server from cron on the other server.
>
> Is that a 'best way' to do this? Do I have to mount the remote
> directory on the local machine to do this?
>

You can use ssh with an authorized key to do this. In short:
On machine A as a regular user, say user alice:
  ssh-keygen -b 768 -t rsa -f identity

This will create an identity and identity.pub file.

  cp identity ~/.ssh

Copy the identity.pub file to the .ssh/authorized_keys file on the remote
machine in the home directory of the user you'll be running the job as.
For example, if you'll be running as user 'bob' on the remote Machine B:

  scp identity.pub bob@machineb:
  (enter password)

Then on machine B as bob:

  cat identity.pub >> ~/.ssh/authorized_keys
  chmod 600 ~/.ssh/authorized_keys

At this point Alice on MachineA should be able to ssh into MachineB as bob
without getting prompted for a password. She can then run programs on
MachineB with:

   ssh bob@machineb programname

You can put this in the user crontab to automate.

-- 
The Digital Hermit      Unix and Linux Solutions
http://www.digitalhermit.com
kwan@digitalhermit.com
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS).  Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 17:46:29 EDT