So I'm trying to write a Perl script to transfer authorized_keys to all the computers on the network from a master computer, but I am having trouble. I'm trying to use scp to copy the whole directory like so:
scp -r ./keys/ $some_machine:/root/.ssh
the thing is, the first time I run this script, the .ssh directory does not exist on the network machines, so the 'keys' directory gets renamed as .ssh and transfered, which is fine. But if I want to add another computer to the network and use the scrip again, instead of overwriting the .ssh directory with the correct files(on machines that i pushed the file to previously), it 'moves' the whole 'keys' directory to the already existing .ssh directory. So now, the .ssh directory will contain a 'keys' directory, instead of the contents of the 'keys' directory. I have no idea how to get around this, any help would be much appreciated!
-ddanj
scp -r ./keys/ $some_machine:/root/.ssh
the thing is, the first time I run this script, the .ssh directory does not exist on the network machines, so the 'keys' directory gets renamed as .ssh and transfered, which is fine. But if I want to add another computer to the network and use the scrip again, instead of overwriting the .ssh directory with the correct files(on machines that i pushed the file to previously), it 'moves' the whole 'keys' directory to the already existing .ssh directory. So now, the .ssh directory will contain a 'keys' directory, instead of the contents of the 'keys' directory. I have no idea how to get around this, any help would be much appreciated!
-ddanj