View Single Post

  #4 (permalink)  
Old 09-25-2007, 06:50 PM
nixcraft's Avatar
nixcraft nixcraft is offline
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Ubuntu
Posts: 1,101
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

There are two ways..
a) Store actual password in text file (which is bit risky if someone got access to file, you are doomed)
b) Use ssh keys for automation and login - which what I recommend
c) Write a daemon / service and work in client / server environment to control all server. Requires network programming using perl / php /c /c++ etc. Difficult to maintain

Solution b is easy to use and implement:
First generate ssh key and upload to all your servers
Don't use su, use sudo w/o password to run commands
Write script to connect such as
Code:
#!/bin/bash
# some init
ssh -l username server1.com
sudo /path/to/command1
sudo /path/to/command2
# and you are done!
Run above script for all server or just add for loop and read all server names form an array.

Hope this helps!
__________________
Vivek | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote