remote ssh commands on multiple hosts
I, looking for a tool that use ssh, to login on multiple hosts specified in a file or command line, and execute a command or list of commands. And would need to some how have store the password, so the whole process is not interactive, So this program will be entered in a simple shell script that is called from a form button from web browser.
I once knew of a program that did precisely as i wanted, but can't recall what it was called :confused:
I have searched all over google for some thing of this nature, and haven't had any luck. Does any one know where i can find some thing like this?
I what I'm looking for can be done in Perl using Net::SSH but, I'm not familiar with Perl, enough to write such a program on my own.
Any Response, would be appreciated
You could setup public key authenication for your ssh sessions. (http://cfm.gs.washington.edu/securit...client-pkauth/)
As far as iterating over host and commands just write a shell script ...
bash-2.05b$ ./test.sh hosts cmds
ssh maple "ls"
ssh maple "pwd"
ssh maple "hostname"
ssh oak "ls"
ssh oak "pwd"
ssh oak "hostname"
ssh pine "ls"
ssh pine "pwd"
ssh pine "hostname"
bash-2.05b$ cat test.sh
for host in `cat $hosts`
for cmd in `cat $commands`
echo "ssh $host \"$cmd\""
bash-2.05b$ cat hosts
bash-2.05b$ cat cmds
And you'll have to have a cgi set up on you web server if you want to be able execute this script via a browser.
since the script would be called by from the web-browser, wouldn't it run a user nobody, so where would the private key be stored?
On my system ...
bash-2.05b$ finger nobody
Login: nobody Name: Nobody
Directory: / Shell: /sbin/nologin
Never logged in.
... so the default location of the private key would be /.ssh and the ssh command would have to use -l user_with_a_shell option to work.
in this thread i forgot to ask how can i key the passphase, and not have to enter it most of the time
Does any one know some thing that works similar to perl's net-ssh from the shell?
you could use expect ... just google for it.
|All times are GMT -5. The time now is 05:13 AM.|