Remote command execution

Posted on 2005-03-15
Medium Priority
Last Modified: 2010-04-21
I have to make changes and install apps on 30 identical machines.  The work is the exact same on each and will be done in the exact same location in each system.  I would like to be able to initiate, scripted or not, something from one system and get to all the other machines.  Unfortunately, I am not allowed to have an .rhosts file on any of the systems.  Are there any alternatives?
Question by:teckwiz01
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 21

Expert Comment

ID: 13548363
If you're not allowed .rhosts files, I bet that your bosses would be unhappy about passwords in scripts too!

Are you allowed to set up ssh to allow you access to the remote systems without a password? Similar to the .rhosts idea, but more secure. ssh can be set up to prompt you for a passphrase once on the local system (to prove it's really you) and then will then do the remote logins without further prompting during that "session"

But it seems to me that the main problem is scripting the installation; If you can do that reliably, it's not too bad to copy the script to each client, open up 30 terminal sessions and run the script "locally" on each system - without the extra worry of if the script will work "remotely"!

If you really want to add the extra complexity of executing the individual commands remotely, the following threads may be of interest (ssh, "expect" and automating telnet):

Author Comment

ID: 13556570
Expect seems to be the next best option.  Have to check on the password in a file issue.  Thanks.  
LVL 21

Expert Comment

ID: 13559652
One of the nice things about "expect" is that you can use `autoexpect` to capture your interactive session and generate the script.  

Obviously the scripts and the system they're held on should be kept secure.

Personally, I'd pursue the ssh route; Then you can scp the script to the remote system and use ssh to execute it, which will avoid a lot of problems.

Author Comment

ID: 13565750
Ok, I thought about using ssh but didn't understand what I read in the previous links.  
1.  You have to setup ssh to not use password?  How?  Will that affect everyone who uses ssh?
2.  How does that help me create a script that remotely executes a series of command on 30 systems?
LVL 21

Accepted Solution

tfewster earned 200 total points
ID: 13568557
1a) Briefly, you create a Public key for ssh on your local system and copy that into to $HOME/.ssh/authorized_keys on the remote system(s);  Then when you ssh to the remote system, it checks the public key & identity of your workstation against the key in authorized keys - and if they match, you're in.  See http://www.experts-exchange.com/Operating_Systems/Solaris/Q_20610462.html for the full process.  (Note, -N '' creates a blank passphrase, which is not a good idea but is closest to the .rhosts style setup.

1b) Nope, only the "pair" of users who have exchanged keys

2) You still have to script it somehow, but it simplifies distributing & running the script.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question