Search code examples
bashapplescriptreplication

BASH/AppleScript Self Replicate File


I'm trying to make an update program that can self replicate across a network using BASH or AppleScript. It must be a one line command if it's done in BASH and SSH keys aren't an option as I don't have direct access to every computer. I guess this is kind of like a worm or something? I have the admin username and passwords for all the computers. Does anyone have a method for this? The computers don't have file sharing turned on either.

In short, I need to replicate with no user interaction.


Solution

  • If just copying it to all machines and then executing it there is an option, try sshpass which lets you "pipe" a password to an ssh/scp password prompt as well as further commands to the machine onto which you are sshing. Take a look here(for scp) and here (for passing commands). Now all you need is that ugly file from which you read user names and passwords - the security issue with this file is obvious, I guess ... I am aware that this would not be self-replicating, but hopefully fulfil your task to update the whole network.