First, I'm TRYING to use rsa keys because I'm using the script to create RSA keys, but initially I have to connect to the remote machine to pass over the newly generated authentication key. Having premade keys is what I'm doing, but I'd like an easier way to get the key to all of these machines.
So here's the deal: I need to connect to 100+ machines and pass over a public key file plus set permissions and turn on key authentication. Right now I can do it in 2 lines: one scp command to transfer and one ssh command to set permissions and turn key authentication back on. But as it is, it's asking for the password twice, for each machine. With over 100 machines needing these keys so I never have to do the password thing again, I don't want to type this password 200 times.
I need some way to insert the password during the connection, just this once (well twice technically). I was hoping for the ability to store the password in a variable while the script ran and then be done with it after the connections are made and the public key is transferred to all these machines.
Edit: forgot to mention, I can't install anything. So I can't use expect.