Hi Brent,
I don't think it's a good idea to use public key authentication to the root account for arbitrary commands. That means that if one machine is compromised, so is the other. I run specific commands remotely as root using
Forced Commands.
That link is to
chapter 8 of O'Reilly's SSH, The Secure Shell, The Definitive Guide. I recommend the reading of the entire chapter as it discusses public key authentication in general. Forced commands are a special case of public key authentication. A specific command is included with the key and when that key is used in authentication, the command is run automatically and secure shell exits as soon as the command is finished. Because the command that is run is specified beforehand, even if the private key is compromised, the intruder can only use it to run that one command.
When I create the public/private key pair, I rename the private key file with a name that reflects the command that will be executed: in my case, bunzip_dsa. I put this in my ~/.ssh directory, although the location isn't important. I use it in the following way:
echo "${TARNAME}" | ssh -i ~/.ssh/bunzip_dsa <server_name>
The pipe isn't necessary in your case but I use it as an example of the flexibility of this technique. My forced command is a shell script and I use the "read" command to read the contents of the pipe. That allows my command to be extremely flexible while still being secure.
--
Gary
~~~~
It's not whether you win or lose, it's how you place the
blame.