LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Multiple file copy (https://www.linuxquestions.org/questions/linux-newbie-8/multiple-file-copy-218651/)

james.farrow 08-17-2004 04:21 AM

Multiple file copy
 
Ok I think I'm about to ask a really stupid question, but here goes!
If I have a DHCP, Web and DNS server IP 192.168.1.1 and say I want to copy a firewall script to all the other PC's on the network IP 192.168.1.1/24 how can it be done from the 1 PC(192.168.1.1)? Or is it not possible?

Thanx for any help!!!

Jimmy

liinux 08-17-2004 05:33 AM

u can ssh in to the pcs

BlueKnight 08-17-2004 06:11 AM

Use scp to copy the file to the PCs.

Example:

Code:

scp firewall <user>@<ip_address>:<path>
Then you just put the correct values in there and off you go. If this seems to manual you can write a shell script:

Code:

#!/bin/ksh

# list of all PCs in the LAN
IPS="192.168.1.1 192.168.1.2 192.168.1.3"

for ip in $IPS ; do
    scp firewall <user>@$ip:<path>
done

exit 0

The "problem" here is that you have to supply the password manually. FTP is another possibility.

james.farrow 08-17-2004 06:39 AM

FTP? Another newbie question, how would I be able to set that up so I can copy files from the 1 location to all the PC's? Is is difficult to do?

BlueKnight 08-17-2004 07:09 AM

You need FTP servers on all the target machines and then in the same fashion as I showed you with scp you put the files to the FTP servers. However, the scp version should be ok IMO.

Please explain what you want to do in order to get the files to the machines. One command and fully automatic, which might require more work in order to get it working or is it okey to have some semi-automated thing like the scp-example, which in turn requires next to no work at all. More details please!

BlueKnight 08-17-2004 07:10 AM

..or you can have one FTP server on the main machine and then FTP clients which get the files from it. Nothing is impossible you know ;)

james.farrow 08-17-2004 07:35 AM

I was thinking along the lines of 1 command and fully automated if its possible.

BlueKnight 08-17-2004 07:56 AM

Take a look at this:

http://www.linuxgazette.com/node/view/193

This is more or less what I showed you, but scp can also be set up to not use passwords. This is done by copying the ssh public key of the user to all the remote machines and then you are automatically authenticated and logged in. Hope this helps you!

james.farrow 08-17-2004 08:01 AM

That sounds like what I was after. Thanx 4 yr help, much appreciated


All times are GMT -5. The time now is 03:16 AM.