LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-20-2006, 02:13 AM   #1
tobiasw
Member
 
Registered: Oct 2006
Distribution: Fedora Core
Posts: 60

Rep: Reputation: 15
Easy .sh script to connect to multiple computers


Hello,
i am looking for a script to connect to multiple pc over ssh and read out a content from a file, and collect all this information into a single file...
Has anybody done that before?

Thanks

Tobias
 
Old 10-20-2006, 11:01 AM   #2
senyahnoj
Member
 
Registered: Jul 2004
Location: Gloucestershire, UK
Distribution: Ubuntu, Debian & Gentoo
Posts: 74

Rep: Reputation: 16
Would scp work?

e.g.

Code:
#!/bin/sh

scp user@server1:/path/file server1file
scp user@server2:/path/file server2file
# etc.

cat server1file server2file > allfiles
# or grep or whatever else you want to do with them

To avoid password prompts you'd need your ssh public key on each server and ssh-agent running on your client.

Last edited by senyahnoj; 10-20-2006 at 11:07 AM.
 
Old 10-20-2006, 05:23 PM   #3
tobiasw
Member
 
Registered: Oct 2006
Distribution: Fedora Core
Posts: 60

Original Poster
Rep: Reputation: 15
very good idea... thank you!

How does ssh public key and the ssh agent works? Is it easy to install them, or they are already implemented?
 
Old 10-20-2006, 07:33 PM   #4
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,784

Rep: Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083Reputation: 2083
Here's a good place to start: http://www.linuxquestions.org/linux/...ation_with_ssh
 
Old 10-23-2006, 04:33 AM   #5
senyahnoj
Member
 
Registered: Jul 2004
Location: Gloucestershire, UK
Distribution: Ubuntu, Debian & Gentoo
Posts: 74

Rep: Reputation: 16
That is a good tutorial on ssh-agent.

In addition, I generally put the following in my ~/.bash_profile to automatically start ssh-agent:

Code:
eval `ssh-agent`
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SSH to multiple computers behind firewall hazmatt20 Linux - Networking 13 08-17-2006 01:32 PM
easy connect not easy in suse greg collins Linux - Newbie 11 03-30-2006 07:31 PM
Using one Samba user for multiple computers Rax Linux - Networking 2 10-28-2004 09:26 AM
compiling on multiple computers Peluso Linux - Software 3 08-30-2004 12:26 PM
Connect multiple computers behind a broadband router timyaukey Linux - Networking 4 07-03-2004 08:44 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration